JAVA SCRIPT

[JS] typeof 연산자에 대해서

해봄코딩 2022. 12. 10. 08:59

 

🚩typeof란? 

피연산자의 자료형을 나타내는 문자열을 반환하는 연산자이다. 

 

형식 

typeof 피연산자 

 

예시 

console.log(typeof 7);
// expected output: "number"

console.log(typeof 'BTS');
// expected output: "string"

console.log(typeof true);
// expected output: "boolean"

console.log(typeof undeclaredVariable);
// expected output: "undefined"

 

 

 

 

'JAVA SCRIPT' 카테고리의 다른 글

[JS] ES6에 대해서  (0) 2022.12.10
[JS] NaN에 대해서  (0) 2022.12.10
[JS] var, let, const에 대해서  (0) 2022.12.10
JS : ?(조건 연산자)에 대해서  (0) 2022.12.07
JS : Date()와 new Date(), getDate()에 대해서  (0) 2022.12.07