Javascript examples for Language Basics:Introduction
The following code shows the Equality and Identity Comparisons for null and undefined Values.
<!DOCTYPE HTML> <html> <head> <title>Example</title> </head> <body> <script type="text/javascript"> var firstVal = null;/* www. j a va 2s .co m*/ var secondVal; var equality = firstVal == secondVal; var identity = firstVal === secondVal; document.writeln("Equality: " + equality); document.writeln("Identity: " + identity); </script> </body> </html>