The most accurate way to check JS object’s type?

The JavaScript specification gives exactly one proper way to determine the class of an object:

Object.prototype.toString.call(t);

http://bonsaiden.github.io/JavaScript-Garden/#types

Leave a Comment