how to know the type of a variable in js 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
}