<!doctype html>
<head>
<title>Check for Number in JavaScript</title>
</head>
<body>
<div id="result_one"></div>
<div id="result_two"></div>
<script>
/* JS comes here */
var num = 1;
var str = "Studytonight";
document.getElementById("result_one").innerHTML = typeof str;
if(!isNaN(num)) {
document.getElementById("result_two").innerHTML = num + " is a number";
}
else {
document.getElementById("result_two").innerHTML = num + " is not a number";
}
</script>
</body>
</html>