JavaScript: verbesserte typeof Function
Posted by skoch on 23. April 2009this.Typeof = function (object) { if (object == null) return ‘null’; if (typeof object == ‘undefined’) return ‘undefined’; if (object.nodeName && object.nodeType == 1) return ‘element’; if (object.nodeName && object.nodeType == 3 && (!/\S/).test(object.nodeValue)) return ‘textnode’; if (object instanceof Function) return ‘function’; if (object instanceof Array) return ‘array’; if (typeof object == ‘object’) return ‘object’; [...]