2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[JS]mapで配列を回す

Posted at

はじめに

Javascript初学者です。JavaScriptのmapを使ったので備忘録として残しておきます。

使い方

let Array = [1,2,3,4,5]
let doubleArray = Array.map( value => {
   return value * 2
})

console.log(doubleArray); 
=> [2,4,6,8,10]

returnを省略するやり方もありそちらのほうがシンプルな見た目になります。

let Array = [1,2,3,4,5]
let doubleArray = Array.map( value =>  value * 2 )

console.log(doubleArray); 
=> [2,4,6,8,10]

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?