● typeof 객체 : 객체의 타입을 출력

console.log(typeof 'string');	// string
console.log(typeof 1);		// number
console.log(typeof []);		// object
console.log(typeof {});		// object
console.log(typeof null);	// object
console.log(typeof function() { });		// function

 

instanceof 객체 : 객체의 인스턴스타입을 출력

let Person = function(){ 
    this.name = "Chris";
}; 
let inst = new Person(); 

inst instanceof Person;     // true
inst instanceof Object;     // true
typeof inst;      	  // object

 

 

'Langauge > Javascript' 카테고리의 다른 글

ECMAScript5 (ES5) - Array 메서드  (0) 2020.07.22
[표준 객체] Math 객체  (0) 2020.07.22
[표준 객체] Date 객체  (0) 2020.07.22
[표준 객체] Array 객체  (0) 2020.07.21
[표준 객체] Number 객체  (0) 2020.07.21

+ Recent posts