In underscore.js, the following code seems to add _.isNumber ()
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { _['is' + name] = function(obj) { return toString.call(obj) == '[object ' + name + ']'; }; });
but something else needs to happen because copying this code directly into firefox makes it fail, because toString.call(5) returns [xpconnect wrapped native prototype] - so it obviously does something else somewhere - but I I can not understand that.
Here is an example of the results in firefox:
http://jsbin.com/uviyaz/2/edit
source share