2015-09-16

javascript: What is the type of this thing?!?!

So you wonder, what the hell is the type of a something? Stack Overflow to the rescue!

Object.prototype.toString.call('abc') // [object String]
Object.prototype.toString.call(/abc/) // [object RegExp]
Object.prototype.toString.call([1,2,3]) // [object Array]

The full explanation and other ideas are here: http://stackoverflow.com/a/332429/357403