1.

What Will Be The Output Of The Code Below? var X = { Foo : 1}; var Output = (function() { delete X.foo; return X.foo; } )(); console.log(output);

Answer»

The output would be undefined. The delete OPERATOR is used to delete the property of an object. Here, X is an object which has the property foo, and as it is a self-invoking function, we will delete the foo property from object x. After doing so, when we TRY to reference a deleted property foo, the RESULT isundefined.

The output would be undefined. The delete operator is used to delete the property of an object. Here, x is an object which has the property foo, and as it is a self-invoking function, we will delete the foo property from object x. After doing so, when we try to reference a deleted property foo, the result isundefined.



Discussion

No Comment Found