22
14

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.

オブジェクトの配列から、特定Keyのみの配列をつくる

Last updated at Posted at 2020-01-20

JavaScript でオブジェクトの配列から、特定のKeyのValueで配列を作る


const hoge = [
 { a : 1, b : 4 },
 { a : 2, b : 5 },
 { a : 3, b : 6 }
];

const fuga = hoge.map((obj) => obj.a);

console.log(fuga); // [1,2,3]
22
14
2

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
22
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?