카테고리 정보를 불러오는 중입니다.

[JS] 변수에 할당된 데이터 속성값 조회

#js#javascript#typeof#데이터타입#frontend
← JavaScript 목록
  • typeof “조회할 변수명”
    // 변수에 할당된 값 데이터 타입 체크 방법
    var abc;
    console.log(typeof abc);
    // undefined;

    abc = 10;
    console.log(typeof abc);
    // number;

    abc = 'Hello';
    console.log(typeof abc);
    // string;

    abc = true;
    console.log(typeof abc);
    // boolean;

    abc = null;
    console.log(typeof abc);
    // object;

    abc = Symbol();
    console.log(typeof abc);
    // symbol;

    abc = {};
    console.log(typeof abc);
    // object;

    abc = [];
    console.log(typeof abc);
    // object;

    abc = function () {};
    console.log(typeof abc);
    // function;

댓글

0개

댓글을 불러오는 중입니다.