js get type of a variable code example
Example: javascript find type of variable
> typeof "foo"
"string"
> typeof true
"boolean"
> typeof 42
"number"
if(typeof bar === 'number') {
//whatever
}
> typeof "foo"
"string"
> typeof true
"boolean"
> typeof 42
"number"
if(typeof bar === 'number') {
//whatever
}