function isNumber(n) {
return !isNaN(parseFloat(n)) && !isNaN(n - 0);
}
if(isNaN(num1))
OR:
if(typeof num1 == 'number'){
document.write(num1 + " is a number <br/>");
}else{
document.write(num1 + " is not a number <br/>");
}
// parseInt is one of those things that you say wtf javascript?
//if you pass to it any argument with number first and letters after, it
// will pass with the first numbers and say yeah this a number wtf?
let myConvertNumber = parseInt('12wtfwtfwtf');
console.log(myConvertNumber);
// the result is 12 and no error is throw or something
//but this
let myConvertNumber = parseInt('wtf12wtf');
console.log(myConvertNumber);
// is NaN wtf?
//if you truly want an strict way to know if something is really a real number
// use Number() instead
let myConvertNumber = Number('12wtf');
console.log(myConvertNumber);
// with this if the string has any text the result will be NaN