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 5 years have passed since last update.

プロパティの呼び出しの注意点

Last updated at Posted at 2019-08-25

##プロパティの呼び出し方
プロパティにアクセスするには「.(ドット)」を使う。
このとき、プロパティ名が有効な識別子でなければいけない。(スペースとかハイフンはだめ)
有効な識別子でないプロパティ名を使う時は、ブラケット表記を使う。

//ブラケット
const obj = {};

obj.color = "yello";
obj["a color"] = "red";

console.log(obj.color);
//"yello"

console.log(obj["a color"]);
//"red"
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?