Inch
In determines whether the left -hand string or the property that can be converted to a string belongs to the right .
var data = {x:1, y:4};//defines the direct object alert ("x" in data),//true, X is a property of data alert (1 in data),//false, 1 is the property value of data 。
var arr = [4, 5, 7];//defines the direct array object alert (0 in arr);//true, the index of the ARR array includes 0,1,2,0 is one of his [0] properties. alert (4 in arr);//false, 4 is not his attribute.
instanceof
instanceof you want the left instance to be the type of object on the right .
var date = new Date (); Alert (date instanceof date),//true alert (date instanceof Object),//true alert (date instanceof number);// False
var date = [1, 2, 3]; Alert (date instanceof Array),//true alert (date instanceof Object),//true alert (date instanceof number);// False
Delete
Delete Deletes an object's properties
var o = {x:1, y:2}; Alert (delete o.x); True Delete Success alert ("x" in O);//false x is not a property of O
var o = 2; Alert (delete this.o);//false y = 3; Alert (delete this.y);//true alert (delete this.window);//false
Summary
Delete is a unary operator, delete cannot delete global variables built into JavaScript, or global variables with var declarations, but you can delete global variables that are not declared with Var.
JavaScript work must Know (vi) Delete in instanceof