I'm very new to JavaScript, and I'm keen to learn. What I'm trying to do is play with the if, else statements. I'm trying to validate two types of strings. I can't seem to validate the numbers, and I can not figure it out for the life of me. Any hints would be greatly appreciated please.
JavaScript : typeof example
<script>
var string1 = 'w3';
var string2 = (1);
if (typeof string1 == 'w3') {
document.write(string1 + " is a number <br/>");
else if (typeof string2 == (1) {
document.write(string2 + "is a number <br/>");
}
} else {
document.write(string2 + " is not a number <br/>");
}
</script>