Skip to content

Instantly share code, notes, and snippets.

@nobuh
Last active December 25, 2018 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobuh/ca6191f70314f82c81f43cc39c4d53dc to your computer and use it in GitHub Desktop.
Save nobuh/ca6191f70314f82c81f43cc39c4d53dc to your computer and use it in GitHub Desktop.
Eloquent Javascript のノート

{ の意味

  • 行頭ではブロックの開始を意味する
  • その他の場所では json オブジェクト

オブジェクトのプロパティの消し方

  • anObject.aProperty = undefined; で消すと、プロパティが残ったまま undefined になる
  • delete anObject.aProperty; で消すと、プロパティそのものが消える。 in オペレーターも false を返すようになる。

const オブジェクトのプロパティの値は変更できる

const score = {visitors: 0, home: 0};
// This is okay
score.visitors = 1;
// This isn't allowed
score = {visitors: 1, home: 1};

== でのオブジェクトの比較

  • 代入によってコピー生成したオブジェクトは、プロパティやその値を変更しても true になる
  • まったく同じプロパティと値を持つオブジェクトを2つつくっても、その比較では false になる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment