+ 3

Could someone explain me how this code works line to line? Thanks.

var x=0; var a=[3,4]; a[x]=++x; document.write(a[0]);

27th Apr 2018, 11:29 AM
Rastislav Romanec
Rastislav Romanec - avatar
2 Réponses
+ 8
a[x]= ++x a[0]=1 Output: 1
27th Apr 2018, 1:15 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 4
That will rewrite former value? a[0] was 3.
1st May 2018, 11:10 AM
Rastislav Romanec
Rastislav Romanec - avatar