3 ms·
Everyday you learn something new Number.prototype.times=function(fn){ for(i=0;i<this;i++){ fn(i); } } 3..times(alert)
by Kilimanjaro 16y ago
Everyday you learn something new
Number.prototype.times=function(fn){
for(i=0;i<this;i++){ fn(i); }
}
3..times(alert)
- atuladhar 16y agoBut then, "native prototypes should never be extended unless it is for the sake of compatibility with newer JavaScript features."
- zoul 16y agoIf somebody’s wondering about the double dot like me: “A common misconception is that number literals cannot be used as objects. That is because a flaw in JavaScript’s parser tries to parse the dot notation on a number as a floating point literal.”