0
Am I right understand, that first x=1 put in arr[1], so we get arr[3+1]=4 and in last arr[0] =2 + arr[1] = 7(4+3) = 9?
4 ответов
+ 2
You're right that x = 1 so arr[x] is arr[1].
However,
arr[x] = arr[x+1] here it means to assign arr[x+1] to arr[x], so arr[x] has the value of arr[x+1]. x = 1, which means arr[1] = arr[2]. Here arr[1] is 7 since arr[2] is 7.
For the last statement you're right.
+ 1
No.
x=1,.
Arr[x] = Arr[x+1] => Arr[1] = Arr[x+1] = 7
document.write (arr[0] + arr[1]);
Arr[0] + Arr[1] = 2 + 7 = 9.
Value at Index x+1=2, i.e value 7 is assigned in Array index at x (i.e 1) so Array is now is [2,7,7]
0
I hope, that I am right a words))
0
Thanks for correct me:)