1.

How to remove the last element from an array in JavaScript?

Answer»

The !! operator is the not operator twice. It is useful in working through the truth value and returns a Boolean value.

LET US see an example:

<!DOCTYPE HTML> <html> <BODY> <script> var val1 = "This is an example"; var val2 = !!val1; document.write(val2); </script> </body> </html>

The OUTPUT:

True

Let us see another example for integer and apply double not to it: 

<!DOCTYPE html> <html> <body> <script> var val1 = 10; var val2 = !!val1; document.write(val2); </script> </body> </html>

The output:

True


Discussion

No Comment Found