'undefined'
or 'null'
if the value is undefined
or null
.Object.prototype.constructor.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'
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️