Types in Javascript How to detect the data type of anything
var type_of = function(x) { var type = Object.prototype.toString.apply(x); return type.slice(type.indexOf(' ') + 1, -1); };