I'm am very new to programming and I am trying to solve a problem where I have to convert an array of Fahrenheit values, to Celsius. Though I am not too sure where to start with .map
and I would really appreciate some help in understanding how to solve this problem.
This was my first attempt in trying to solve the test problem.
function convertTemps(array) {
return array * (9/5) + 32
}
These are the problems I am trying to solve
describe('convertTemps', () => {
it('should convert farenheit to celcius for all temperatures in the array', () => {
expect(convertTemps([23, 140, 212, 41])).to.deep.equal([-5, 60, 100, 5])
expect(convertTemps([-58, -22, -4, 14])).to.deep.equal([-50, -30, -20, -10])
expect(convertTemps([104, 122, 158, 176])).to.deep.equal([40, 50, 70, 80])
})
})
If you can use es6 (arrow functions)
function convertTemps(array) {
return array.map(element => element * (9/5) + 32);
}
I am trying to set up the following architecture: a core React application that gets built with some basic functionality, and the ability to load additional React components at runtime. These ...
I am trying to set up the following architecture: a core React application that gets built with some basic functionality, and the ability to load additional React components at runtime. These ...
I have a chart that shows the time in and time out for the employees on a daily basis. I've fetched the data from the database and all was working well. But now the columns show the data incorrectly ...
I have a chart that shows the time in and time out for the employees on a daily basis. I've fetched the data from the database and all was working well. But now the columns show the data incorrectly ...
I've got a tree like: { "nodes": [ { "id":1, "children":[ { "id":3, "children":[ {"id":4, "children":[]}, {"id":5, "children":[{"...
I've got a tree like: { "nodes": [ { "id":1, "children":[ { "id":3, "children":[ {"id":4, "children":[]}, {"id":5, "children":[{"...
Please see this minimum example https://codepen.io/rockmandash/pen/Rzwowd The code is this: <div class="cool"> <input type="checkbox" value="checkbox1"> <input type="checkbox" ...
Please see this minimum example https://codepen.io/rockmandash/pen/Rzwowd The code is this: <div class="cool"> <input type="checkbox" value="checkbox1"> <input type="checkbox" ...