if (typeof i != "number") {
console.log('This is not number');
}
// You can use the built-in method 'typeof' in order to check the variable datatype
//examples:
typeof "hello" // "string"
//or
var a = 1;
typeof(a);
//the output will be > 'number'
let store = [1,2,3]; console.log(typeof store);
> typeof "foo"
"string"
> typeof true
"boolean"
> typeof 42
"number"
if(typeof variable == 'object'){
//
}
if (typeof i != "number") {
console.log('This is not number');
}
// You can use the built-in method 'typeof' in order to check the variable datatype
//examples:
typeof "hello" // "string"
//or
var a = 1;
typeof(a);
//the output will be > 'number'
let store = [1,2,3]; console.log(typeof store);
> typeof "foo"
"string"
> typeof true
"boolean"
> typeof 42
"number"
if(typeof variable == 'object'){
//
}