[Solved] How do I make a numerical array’s increase amount smaller in each step? [closed]


Change the increment amount as you please…

var arr = [];
var i = 1;
var incrementAmt = 2000;

for(var j = 0; j < 1000; j++) {
    var num = i + incrementAmt;
    arr.push(num);
    i = num;
    i++;
    incrementAmt = incrementAmt / 2; // cause incrementer to decrease each iteration
}

console.log(arr)

1

solved How do I make a numerical array’s increase amount smaller in each step? [closed]