Type of value

JavaScript, Type · Oct 19, 2020

Returns the native type of a value.

const getType = v =>
  (v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name);

getType(new Set([1, 2, 3])); // 'Set'

More like this