Skip to content

Instantly share code, notes, and snippets.

@taisyo7333
Created February 24, 2016 02:39
Show Gist options
  • Save taisyo7333/1a98c0a564cf6e810f51 to your computer and use it in GitHub Desktop.
Save taisyo7333/1a98c0a564cf6e810f51 to your computer and use it in GitHub Desktop.
JavScript 調べたこと。
調べた英単語
hoist [verb]
1. to raise (something) especially by using ropes or machinery
ロープなどを使って持ち上げる。
2. drink (informal)
3. to take a shot , (basketball , informal)
使用例) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
An important difference between function declarations and class declarations is that function declarations are hoisted and class declarations are not.
和訳(自前)
関数宣言とクラス宣言の重要な違いは、関数宣言はhoistingするが、クラス宣言はしない。
— >> 意味不明なので、さらに調査。
関数宣言とクラス宣言の重要な違いは、関数宣言は「どこに書いてもOK」だが、クラス宣言は、OKではない。
※クラス宣言は前方参照(Forward Reference)の制約があるため、実行部の前に記述する必要がある。
>調査内容
— >> Forward Reference の制約がないことをJavaScript ではHoisting と言うらしい。
— >> 関数が実行部の前に定義されている必要はなく、実行部の後ろでも良いということのようだ。あるScope内にあれば実行時に探し出せるらしい。あるScope内とは関数のことだろうか?
http://www.i-programmer.info/programming/javascript/5364-javascript-hoisting-explained.html
http://www.learners-dictionary.com/definition/hoist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment