* インスタンスオブジェクトの型 [#u486a33e]

 function Human() {}
 
 var human = new Human();
 
 typeof human           // => "object"
 human instanceof Human // => true
 human.constructor      // => function Human() {}
 
 var humanB = new human.constructor();
 typeof humanB           // => "object"
 humanB instanceof Human // => true
 humanB.constructor      // => function Human() {}

 function Animal() {};
 
 function Human() {};
 Human.prototype = Animal.prototype;
 
 var human = new Human();
 
 human instanceof Human  // => true
 human instanceof Animal // => true
 human instanceof Object // => true


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS