javascript type of code example
Example 1: get type of var js
function doSomething(x) {
if(typeof(x) === 'string') {
alert('x is a string')
} else if(typeof(x) === 'number') {
alert('x is a number')
}
}
Example 2: type of javascript
if (typeof(value) !== "undefined") {
}
Example 3: js typeof number
console.log(typeof 93);
console.log(typeof 'Maximum');
console.log(typeof false);
console.log(typeof anUndeclaredVariable);
Example 4: check data type in javascript
typeof("string");
typeof(123);
Example 5: type javascirpt
console.log(typeof 42);
Example 6: javascript get type of var
typeof operando