偶尔看到js中有个这种用法,比如:
if(!("io" in window)){
setError("io not defined");
return false;
}
不是很明白,在网上又不知道用什么关键字来查询,所以在这里请教各位!
if(!("io" in window)){
setError("io not defined");
return false;
}
不是很明白,在网上又不知道用什么关键字来查询,所以在这里请教各位!
var Person=function(name,age){
this.name=name;
this.age=age;
};Person.prototype.hello=function(){
alert('I\'m '+this.name+' ,'+this.age+' years old');
};var p=new Person('Rattz',20);
p.hello();alert('hello' in p);
alert(p.hasOwnProperty('hello'));
if(io!=undefined)或者if(typeof(io)!='undefined')