Skip to content

Instantly share code, notes, and snippets.

@sekky0905
Created June 13, 2017 04:39
Show Gist options
  • Save sekky0905/b8a0c21114cdcb85c1564684b3c27f46 to your computer and use it in GitHub Desktop.
Save sekky0905/b8a0c21114cdcb85c1564684b3c27f46 to your computer and use it in GitHub Desktop.
Javascriptの配列mapメモ ref: http://qiita.com/Sekky0905/items/5e2db96785e839eb588a
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}`);
map後の配列は、one,two,other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment