0
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.

【Javascript】配列の中にあるオブジェクトを取得したい

Posted at

###以下の配列から2番目のオブジェクトにあるyのバリューを取り出したい場合

sample.js
  const points = [
    {x: 10, y:20},
    {x: 30, y:40},
    {x: 50, y:60},
  ];

###取得方法
配列の番号を指定してその番号(オブジェクト)の値を指定してあげるとバリューを取得可能
console.log(points[1]["y"])もしくはconsole.log(points[1].y)

sample.js
  const points = [
    {x: 10, y:20},
    {x: 30, y:40},
    {x: 50, y:60},
  ];

0
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
0
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?