typeOf()

typeOf()

Gets the specific object type of any value.

type-of.func.ts
const typeOf = (value: any): string =>
  Object.prototype.toString.call(value).slice(8, -1).toLowerCase();

Parameters

value: any

The value of any type to obtain its object class name.

Returns

The return value is the object class name of the given value.

Example usage

Last updated

Was this helpful?