ホイスティングとは
ホイスティングとはコンテキスト内で宣言した変数や関数の定義をコード実行前にメモリーに配置すること
a();
function a(){
console.log('a is called'); a is called
}
a();
function a(){
console.log('a is called'); ok
}
var b;
console.log(b); //undefined
b = 0;
console.log(b); //0
console.log(b);
const b = 0; //reference error
*ブラウザのJSエンジンによっても挙動が変わるには注意
ChromeのV8エンジンとFire FoxのSpider monkey