function typeof(o){ var _toString=Object.prototype.toString; var _type={ "undefined":"undefined", "number":"number", "boolean":"boolean", "string":"string", "[object Function]":"function", "[object Array]":"array", "[object RegExp]":"regexp", "[object Date]":"date", "[object Erroe]":"error" } return _type[typeof o]||_type[_toString.call(o)]||(o?"object":"null"); }