[1,2,3,4]is an array literal .
1,2- these are two numbers with a comma between them, therefore it is allowed 2.
So you get index 2 (third element) from the array.
var array = [1,2,3,4];
var property = (1,2);
var result = array[property];
console.log({ array: array, property: property, result: result });
Run code source
share