+ 6
I don't understand array in Javascript đđ
Can you help me expland this program. I think it so easy with someone but I can figure out how it work and go to output the result 0,1. Why it not 1,3??? . . var arr=[]; arr[0]=arr.length; arr[1]=arr.length + arr[0]; document.write(arr);
4 Answers
+ 12
in the first statement arr.length =0 because there is not any element in the array so arr[0]=0 and in second statement arr[1]=1 because after first statement
arr contain one element 0 so array length is 1 hence it shows 0,1 hope this is helpful for you
+ 1
Because the array has a size of 0 until you add elements
0
.