isPrototypeOf的实例
isPrototypeOf的实例演示
by kixi
HTML
isPrototypeOf的实例
CSS
/*
清晰网
kixi.com.cn
从javascript出发
*/
JavaScript
function Fee() {
// . . .
}
Fee.prototype.test = function(){
alert('bbbb');
}
function Fi() {
// . . .
}
Fi.prototype = new Fee();
function Fo() {
// . . .
}
Fo.prototype = new Fi();
function Fum() {
// . . .
}
Fum.prototype = new Fo();
var fum = new Fum();
// 原意: 检查该对象是否在参数object的原型链上.
// 注意: 是检测对象
// 出错: 将Fee换成test会出错
if (Fee.prototype.isPrototypeOf(fum)) {
alert('我在fum的原型链上');
fum.test();
}