What will be the output of the following code?

Technology CommunityCategory: JavaScriptWhat will be the output of the following code?
VietMX Staff asked 3 years ago
Problem
var output = (function(x) {
  delete x;
  return x;
})(0);

console.log(output);

Above 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 variabledelete operator doesn’t affect local variable.