如果指定屬性在指定對(duì)象中或它的原型鏈中,返回 true
注意下面這種情況:
var color1 = new String('green');
'length' in color1 // returns true
var color2 = 'coral';
'length' in color2 // generates an error (color2 is not a String object)
如果指定屬性在指定對(duì)象中或它的原型鏈中,返回 true
注意下面這種情況:
var color1 = new String('green');
'length' in color1 // returns true
var color2 = 'coral';
'length' in color2 // generates an error (color2 is not a String object)