1.

Why do we use the !! (not not) operator in JavaScript?

Answer»

The “undefined” is used to unset a variable in JavaScript.

Declare and INITIALIZE a variable:

]var a = 50;

Now reassign the variable with undefined SINCE we wish to unset it: 

a = undefined;

The following is an example: 

<!DOCTYPE html&GT; <html> <body> <script>     var a = 50;     a = undefined;     document.write(a); </script> </body> </html>

The output displays undefined:

Undefined

If you are implicitly declaring the variable without var keyword, then USE the delete to unset a variable: 

<!DOCTYPE html> <html> <body> <script>     a = 10;     delete a; </script> </body> </html>


Discussion

No Comment Found