0 votes
in JavaScript by

What output will this code present:

var X = { Foo : 1};

var Output = (function()

{

delete X.foo;

return X.foo;

}

)();

console.log(output);

1 Answer

0 votes
by

Undefined output. Delete operator helps to delete the properties from an object. In this code, x is an object with the property used foo. This is a self-invoking function and hence, one would delete the property foo from x object. Hence, the result will be undefined.

Related questions

0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
0 votes
asked Mar 20, 2021 in JavaScript by sharadyadav1986
...