Compare string against integer with a strict test : String Comparison « Data Type « JavaScript DHTML






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>

   
    
  








Related examples in the same category

1.Compare string against integer against simple test
2.If a lower case string is greater than, equal to, or less than the same string in upper case characters.
3.Comparing two strings
4.Identity and Equality