instanceof 키워드_생성자함수와관련

Javascript&Jquery 2012. 1. 23. 17:38
//생성자 함수 선언
function Student(name) {this.name=name;}

//변수를 선언
var student = new Student('유인성');

//출력
alert(student instanceof Student);
alert(student instanceof Number);
alert(student instanceof String);
alert(student instanceof Boolean);

새로생성된게 name밖에 없으니까 처음뜨는 alert 만 true 출력 
posted by 알 수 없는 사용자