@erwijet/ntimes
v1.0.2
Published
ntimes is a fast way of replacing old for loopss --- ## Docs ```javascript const ntimes = require('@erwijet/ntimes'); ntimes( n, func (i), delta, start ) ``` |Param|Use| |---|---| |n|Repeat until i < n| |func (i)|The function to call with each pass| |delt
Downloads
4
Readme
ntimes
ntimes is a fast way of replacing old for loopss
Docs
const ntimes = require('@erwijet/ntimes');
ntimes( n, func (i), delta, start )
|Param|Use| |---|---| |n|Repeat until i < n| |func (i)|The function to call with each pass| |delta|The value to change i by with each pass| |start|The value to start i at|
Example
const ntimes = require('@erwijet/ntimes');
ntimes(5, i => console.log('this is pass number ' + i);
// OUTPUT:
// this is pass number 0
// this is pass number 1
// this is pass number 2
// this is pass number 3
// this is pass number 4
ntimes(10, i => console.log('this is pass number ' + i), 2, 1);
// OUTPUT:
// this is pass number 1
// this is pass number 3
// this is pass number 5
// this is pass number 7
// this is pass number 9