Getting the data type or constructor:
type("some string"); // 'string'
type(42); // 'number'
type(true); // 'boolean
Checking for a data type or constructor:
type.isNumber(42); // true
type.isNumber("string"); // false
type.isRegExp(/\d/); // true
The type
function itself always returns a string. Methods of type
always return a boolean.