Created
September 8, 2017 13:54
-
-
Save andilabs/17a4485613951875c25f2f44478b719d to your computer and use it in GitHub Desktop.
Shorter functions
From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
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
var materials = [ | |
'Hydrogen', | |
'Helium', | |
'Lithium', | |
'Beryllium' | |
]; | |
materials.map(function(material) { | |
return material.length; | |
}); // [8, 6, 7, 9] | |
materials.map((material) => { | |
return material.length; | |
}); // [8, 6, 7, 9] | |
materials.map(material => material.length); // [8, 6, 7, 9] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment