This code will output 0
as output. delete
operator is used to delete a property from an object. Here x
is not an object it's local variable. delete
operator doesn't affect local variables.
Source
xxxxxxxxxx
var output = (function(x) {
delete x;
return x;
})(0);
console.log(output);
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment