Skip to content

iterate

Like a reduce but does not require an array. Only need a number and will iterate the function as many times as specified. NOTE: This is NOT zero indexed. If you pass count=5 you will get 1, 2, 3, 4, 5 iteration in the callback function.

Usage

iterate(3, (total, i) => total + i, 0);
// 6

Installation

Terminal window
npx atmx add helper iterate