YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* インスタンスオブジェクトの型 [#u486a33e]
** 継承なし [#m6dfd30b]
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() {}
** 継承あり [#w05703f7]
function Animal() {};
function Human() {};
Human.prototype = Animal.prototype;
var human = new Human();
human instanceof Human // => true
human instanceof Animal // => true
human instanceof Object // => true
終了行:
* インスタンスオブジェクトの型 [#u486a33e]
** 継承なし [#m6dfd30b]
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() {}
** 継承あり [#w05703f7]
function Animal() {};
function Human() {};
Human.prototype = Animal.prototype;
var human = new Human();
human instanceof Human // => true
human instanceof Animal // => true
human instanceof Object // => true
ページ名: