js es6 check variable type code example Example: javascript check type of variable var > typeof "foo" "string" > typeof true "boolean" > typeof 42 "number"