in
in Determine whether the string on the left or the attribute that can be converted into a string belongs to the right.
var data = { x: , y: };//Define the direct object alert("x" in data);//true , x is an attribute alert( in data);//false , which is the attribute value of data. var arr = [, , ];//Defines the direct array object alert( in arr);//true ,arr The index of the array includes,, is one of its [] attributes. alert( in arr);//false, not its attribute.instanceof
instanceof You want the instance on the left to be the type of the object on the right.
var date = new Date();alert(date instanceof Date);//truealert(date instanceof Object);//truealert(date instanceof Number);//false var date = [, , ];alert(date instanceof Array);//truealert(date instanceof Object);//truealert(date instanceof Number);//false
delete delete
delete delete the attributes of an object
var o = { x: , y: };alert(delete ox); //true Delete successfully alert("x" in o);//false x is not an attribute of o var o = ;alert(delete this.o);//falsey = ;alert(delete this.y);//truealert(delete this.window);//falseSummary
delete is a unary operator. delete cannot delete built-in global variables in JavaScript, nor can it delete global variables declared by var, but it can delete global variables that are not declared by var.
The above is the relevant knowledge about JavaScript must-know (Sixth) delete in instanceof introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support to Wulin.com website!