var brackets = [];
for(i = 0; i < 5; i++){
brackets.push(15 += 5)
}
First of all, when you put "15 += 5" means nothing, because 15 is a number not a variable.. unless you put a variable "a" like this:
var brackets = [15];
var a=15;
for(i = 0; i < 5; i++){
brackets.push(a += 5)
}
and
var brackets = [15];
for(i = 0; i < 5; i++){ brackets.push(brackets[0] += 5) }
But it gives this output: [ 40, 20, 25, 30, 35, 40 ]
well.. "brackets[0]" is a variable... when you do "brackets[0] += 5" it will do 15+5 and store the result (20) on brackets[0], after that it does "brackets.push(20)" in which brackets has now [20,20]..
the second time it will be [25,20,25], after that [30,20,25,30] and so on until you get [40,20,25,30,35,40]..
A solution for this one would be:
var brackets = [15];
for(i = 0; i < 5; i++){ brackets.push(brackets[i] + 5) }
15 += 5to do?for (var i = 15; i <= 40; i += 5) { ... }