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
/* ES6 the Lazy Way */ | |
var nums = [1, 2, 3, 4, 5, 6] | |
// You don't have to use braces when it is a simple expression | |
// No need to say return, it just knows | |
// The fat arrow is creating the function | |
// If we have one arg, no need to add parens | |
var odds = nums.map(v => v + 1); // [ 2, 3, 4, 5, 6, 7 ] |
NewerOlder