How do you check the type of a variable?
typeof
Example
var x = 12345;
console.log(typeof x)
x = 'string';
console.log(typeof x)
x = { key: 'value' };
console.log(typeof x)
Answer
number
string
object
BY Best Interview Question ON 25 Aug 2022