수진님 에게 배운점

숫자 타입이 아닌 경우, 숫자 타입으로 변환 후 검사

console.log(isNaN('10'));  // '10' -> 10, 그래서 false
console.log(isNaN(''));    // '' -> 0, 그래서 false

console.log(isNaN(new Date())); // false, date 객체는 정수 값을 담기 때문에 number

console.log(isNaN(new Date().toString()));  // string, 그래서 true
console.log(isNaN(null));       // null -> 0, 그래서 false
console.log(isNaN(true));       // true -> 1, 그래서 false
console.log(isNaN(undefined));  // undefined -> NaN, 그래서 true

재영님 에게 배운점

const x = 1;

function foo() {
  const y = 2;

  function bar() {
    const z = 3;
    console.log(x + y + z);
  }
  bar();
}
foo();
  1. 전역 변수 const x = 1이 스택에 push된다.
  2. 함수 foo()와 지역 변수 const y = 2가 스택에 push된다.
  3. 함수 bar()와 지역 변수 const z = 3이 스택에 push된다. 이때 console.log(x+y+z)가 호출이 되고 pop된다.
  4. 더 이상 실행해야 하는 코드가 없으니 함수 foo()가 스택에서 pop된다.
  5. 더 이상 실행해야 하는 코드가 없으니 함수 foo()가 스택에서 pop된다.

이번 학습을 통해서 스스로가 배운 점