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); }

6th Feb 2021, 10:05 PM
Jalal SA
1 Respuesta
+ 1
c+="* " is equal to c=c+"* ". Now first time we have c="" +"* "="* " n=1; Second time , c="* "+"* "="* * " n=2 And so on.
6th Feb 2021, 10:16 PM
Abhay
Abhay - avatar