Comparing string to int inside if statement - Javascript Statement

Javascript examples for Statement:if

Description

Comparing string to int inside if statement

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from ww w  .j  a v a  2  s.c om*/

var myString =  "3T-4T";

var notValidate = myString.substring(3, 4);
if(notValidate == 4)
{
console.log("Value1");
}
else
{
console.log("null");
}
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials