I have followed these links
How [1,2] + [4,5,6][1] = 1,25 in JavaScript
Why does [5,6,8,7][1,2] = 8 in JavaScript?
but not able to understand why the following code is undefined
. My understanding is [1,2,3]
will give 3, so from [1,2,3,4,5,6,7][3]
will be 4 and hence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
will be [1, 2, 3, 4, 5, 6, 7, 8, 9, 10][4]
that is 5. But it logs undefined.
console.log([1, 2, 3, 4, 5, 6, 7, 8, 9, 10][1, 2, 3, 4, 5, 6, 7][1, 2, 3])