728x90
반응형
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
// code from https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Functions/%EC%95%A0%EB%A1%9C%EC%9A%B0_%ED%8E%91%EC%85%98 | |
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(({length}) => length); // [8, 6, 7, 9] |
728x90
반응형
'Javascript' 카테고리의 다른 글
non TDZ (0) | 2018.11.22 |
---|---|
closure (0) | 2018.11.22 |
fibonacci.js (0) | 2018.11.08 |
iteration from 'Learning Javascript' (0) | 2018.11.08 |
javascript require 예제 (0) | 2018.08.23 |