Use typeof to check a value's type:
typeof 42 // "number"
typeof "hello" // "string"
typeof true // "boolean"
typeof undefined // "undefined"
typeof null // "object" (bug!)
typeof {} // "object"
typeof [] // "object"
Note the quirks: null reports as "object" due to a historical bug. Arrays also report as "object". Use Array.isArray() to check for arrays.