1.

What are Symbol primitive type in JavaScript?

Answer»

null (var null)

In JavaScript, null is a RESERVED identifier, therefore we cannot use it as an identifier in JavaScript. An error can be seen if we will write:

&LT;html>  <body>    <script>    var null;    </script>  </body> </html>

The following is the error VISIBLE when you will press F12 on browser: 

SYNTAXERROR: Unexpected token null

The web browser throws an error for “var null” since it is a reserved identifier.

UNDEFINED (var undefined)

The undefined is not a reserved identifier, therefore if you will write the following, then no error would be thrown:

<html>  <body>    <script>    var undefined;    document.write(undefined);    </script>  </body> </html>

Even if it is undefined, let us see what would be the output: 

Undefined


Discussion

No Comment Found