TIL2: JavaScript Data Type

Charlie·2020년 9월 7일
0

Pre Course TIL

목록 보기
2/45
post-thumbnail

Javascript에서 Data Type은 크게 6가지가 있습니다.
1. Number
2. String
3. Boolean
4. Object
5. Undefined
6. Function

  • 그리고 변수나 값의 Data Type을 확인해 볼수 있는 키워드로써 typeof가 있습니다.
    typeof 1;          // "number"
    typeof 'a';        // "string"
    typeof true;       // "boolean"
    typeof [1, 2];     // "object"
    typeof {a:1, b:2}; // "object"
    typeof a;          // "undefined"
    typeof alert;      // "function"
  • 위의 결과에서 볼 수 있듯이 Array는 Object Type으로 분류됩니다.

0개의 댓글