Returns the native type of a value.
'undefined'
or 'null'
if the value is undefined
or null
.Object.prototype.constructor
and Function.prototype.name
to get the name of the constructor.const getType = v =>
(v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name);
getType(new Set([1, 2, 3])); // 'Set'
JavaScript, Type
Checks if the given argument is a native boolean element.
JavaScript, Type
Checks if the a value is an empty object/collection, has no enumerable properties or is any type that is not considered a collection.
JavaScript, Type
Checks if an object looks like a Promise
.