Hacker News new | ask | show | jobs
by dclowd9901 4349 days ago
Really makes me wish you could invoke instance methods on numbers (ala 5.amIFive())
2 comments

You can :)

Number.prototype.amIFive = function(){ return this.valueOf() == 5; }

5..amIFive();

Ah, so you have to have two dots... I suppose the first one denotes the floating point value, and the second denotes the prototype accessor. Very clever.
(5).amIFive();