If I am reading correctly the first array is just an array literal, and the second array is accessing an element in the first array.
In the example console.log([5,6,7][1,5,6,2]) the last element of second array is 2, so it is returning the element at index 2 of the first array which is 7.
Why is javascript simply ignoring all other elements in second array and accepting to use the last element in the second array as an index reference? What is happening with contents of second array? why is it not an error that asks for just a number? Also Why not take the first element in the second array why the last?
Another example: console.log(['French Roast', 'Colombian', 'Kona']['1', 'Kona', true, 0]); simply returns 'French Roast'.
to add to question: knowing that the comma 'does' something in javascript, definitely clarifies things a little bit. Am I to understand that commas get 'evaluated' or actually have functionality associated with it in Javascript. I assumed it was just a character to separate elements. is there a function that goes on behind the scenes comparing and sorting when the comma is in play? also how is it stopped when you just want to use as a separation between elements?