Created
February 9, 2017 16:25
-
-
Save kuznetsovandrey76/87ccd5af83b9fbec5eef06871be51353 to your computer and use it in GitHub Desktop.
This file contains 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
let array1 = [2, 3, 4]; | |
let array2 = array1.map(function(number) { | |
return number * number; | |
}); | |
// если в фнкции один параметр () можно опустить | |
// если функция делает только возврат {} и return можно опустить | |
let array3 = array1.map(number => number * number); | |
console.log(array1); // [ 2, 3, 4 ] | |
console.log(array2); // [ 4, 9, 16 ] | |
console.log(array3); // [ 4, 9, 16 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment