0
how to assign value of z = ++b without changing the value of b.
var a = 3, b = 2, z = ++b, z = b + a; console.log(z); console.log(b); //Output: (1+2)+3 = 6 //Output: (1+2) = 3 I want to get z=b+1=3 but at the same time I want to use b later as the first given value b=2 how to do that
4 Respostas
+ 5
z=b+1, sets Z to 3 and doesn't increase b
0
Can we do that with arrays forexample to increase a string for many times or make loop?
0
Elva
0
What do you mean increase string? Considering arrays you can do a = myarr[0]+1, value of first element of myarr won't change but a will be that element +1, same thing as previous answer