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: };//Directed direct objectalert("x" in data);//true , x is a property of dataalert( in data);//false , is the property value of data.var arr = [, , ];//Define direct array objectalert( in arr);//true ,arr The index of the array includes,, is one of its [] attributes.alert( in arr);//false ,Not his 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);//true alert(date instanceof Object);//true alert(date instanceof Number);//false var date = [, , ]; alert(date instanceof Array);//true alert(date instanceof Object);//true alert(date instanceof Number);//false
delete
delete delete the properties of an object
var o = { x: , y: }; alert(delete ); //true Delete successfullyalert("x" in o);//false x is not an attribute of ovar o = ; alert(delete );//false y = ; alert(delete );//true alert(delete );//false
summary
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 (Six) 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 for my website!