JavaScript – Know thy Object Type


Tech Bytes

In the absence of any getClass() counterpart in JavaScript, know your JS object’s class like so –

»> s = ‘test string’

“test string”

»> typeof(s)

“object”

»> Object.prototype.toString.call(s)

“[object String]”

For other pointers to knowing object types, refer here

View original post