浅谈javascript的数据类型检测(2)


function Animal() {
}
function Cat() {
}
Cat.prototype = new Animal();
Cat.prototype.CatchMouse = function () {
//do some thing
}
var garfield = new Cat();
alert(garfield instanceof Cat); //true 毫无疑问
alert(garfield instanceof Animal); //true 可以理解


好了,关于javascript的数据类型检测,楼猪就大致总结介绍到这里了。希望有心的高人补充。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdxjxg.html