javascript - Generate arrays of numbers in certain algorithm -
so need few arrays
:
array 1 = [1,9,17,25,33,41]; array 2 = [2,10,18,26,34,42];
etc.
each array
adds 8 last item.
but, need generate dynamically (using functions in javascript).
var initvalue = 5; var diff = 8; var len = 5; function makediffarray(initvalue, diff, len) { (var = 0, arr = []; < len; i++) { arr.push(initvalue); initvalue += diff; } return arr; } console.log(makediffarray(initvalue, diff, len));
Comments
Post a Comment