0
Can some explain to me why when i run this code its goes like a triangle shape
var c = ""; var n = 1; while (n <= 10) { c += "* "; n++; console.log(c); }
1 Odpowiedź
+ 1
c+="* " is equal to c=c+"* ".
Now first time we have c="" +"* "="* "
n=1;
Second time , c="* "+"* "="* * "
n=2
And so on.