holdanddeepdive/javascript-deep-dive

20장 strict mode

Opened this issue · 2 comments

20.6.1 함수바인딩: this

318.p

strict mode non strict mode
일반함수 undefined 전역객체에 바인딩
생성자(new 연산자 사용) 자기 자신(객체)에 바인딩 자기 자신(객체)에 바인딩

즉시 실행 함수 복습

  • 변수에 할당하는 경우
let num = 2;
const a = (function () {
  console.log("-- 실행 --");
  num++;
  return num;
})();
console.log(typeof a); // 즉시실행함수를 실행한 결과가 저장되어 있음
console.log(a);
console.log(num);
-- 실행 --
number
3
3