_.isNaN = function(obj) {
return _.isNumber(obj) && isNaN(obj); //_.isNumber ?
}
_.isNumber is not defined in other parts. According to the && operator, the _.isNumber method is not defined, so _.isNumber(obj) is false, so what is returned is isNaN( obj), why not just return isNaN(obj)?
phpcn_u15822017-05-19 10:42:56
I found the point. . . I saw it wrong, it turned out to be here
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError, isMap, isWeakMap, isSet, isWeakSet.
_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error', 'Symbol', 'Map', 'WeakMap', 'Set', 'WeakSet'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) === '[object ' + name + ']';
};
});