LoginSignup
20
13

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]
20
13
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
20
13