Created
May 23, 2020 05:30
-
-
Save hebertcisco/391d284bbed28f1c1b5118bc9c95df96 to your computer and use it in GitHub Desktop.
The map () method invokes the callback function passed by argument for each element of the Array and returns a new Array as a result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const temperatureCelsius = [0, 22, 31, 40, 45, 12, 3]; | |
const toFahrenheit = (value) => (value * 9) / 5 + 32; | |
const temperatureFahrneheit = temperatureCelsius.map(toFahrenheit); | |
console.log(temperatureCelsius); | |
console.log(temperatureFahrneheit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment