Mega Code Archive

 
Categories / JavaScript DHTML / Data Type
 

Compare string against integer with a strict test

<html> <head>     <title>Equality</title>     <script type = "text/javascript">     var x = 42;     var y = "42";     if (x ===y) {         document.write("x is equal to y with a strict test.");     } else {         document.write("x is not equal to y");     }     </script> </head> <body> </body> </html>