Mega Code Archive

 
Categories / JavaScript DHTML / Data Type
 

Identity and Equality

<html> <head> <title>Identity and Equality</title> <script type="text/javascript"> var sValue = "3.0"; var nValue = 3.0; if (nValue == "3.0") document.write("According to equality, value is 3.0"); if (nValue ==="3.0") document.write("According to identity, value is 3.0");   if (sValue != 3.0) document.write("According to equality, value is not 3.0"); if (sValue !== 3.0) document.write("According to identity, value is not 3.0"); </script> </head> <body> <p>Some page content</p> </body> </html>