Changeset 9365

Show
Ignore:
Timestamp:
11/06/08 23:24:59 (1 year ago)
Author:
hannes
Message:

Implement Number.prototype.times() to prevail in weblog pissing contests with ruby and groovy

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • helma-ng/trunk/modules/core/number.js

    r9355 r9365  
    9696    return new Date(date.getTime() + this); 
    9797}, false, false, true); 
     98 
     99 
     100Number.prototype.__defineProperty__('times', function(fun) { 
     101    for (var i = 0; i < this; i++) { 
     102        fun(i); 
     103    } 
     104}, false, false, true);