Created
June 13, 2017 04:39
-
-
Save sekky0905/b8a0c21114cdcb85c1564684b3c27f46 to your computer and use it in GitHub Desktop.
Javascriptの配列mapメモ ref: http://qiita.com/Sekky0905/items/5e2db96785e839eb588a
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 numArray = [1, 2, 3]; | |
let strArray = numArray.map((move) => { | |
switch (move) { | |
case 1: | |
return 'one'; | |
case 2: | |
return 'two'; | |
default: | |
return 'other'; | |
} | |
}); | |
console.log(`map後の配列は、${strArray}`); |
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
map後の配列は、one,two,other |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment