Beautiful JS

JavaScript that belies the common conception of beauty

Underscore's isNaN method

// Is the given value `NaN`? `NaN` happens to be the only value in JavaScript
// that does not equal itself.
_.isNaN = function(obj) {
    return obj !== obj;
};

See _.isNaN on github.

It’s also worth mentioning Underscore’s annotated source.

Posted by James on 29 Sep 2011 | linky

Subscribe or follow @Beautiful_JS! | Fork then send a pull request to contribute.

Disclaimer: Beautiful code is readable, maintainable and scalable. It's not just nice to look it.