数组文字作为对象键?

Array literal as object key?

看到 this answer 提出挑战,我感到很惊讶,因为我不知道这种语法是合法的。即,看起来像这样的部分(我简化了一点):

"eo"[0,g=()=>{},g(),g(),1]

对我来说,这看起来像是一个数组文字被用来访问一个对象键。 JavaScript 中是否记录了这种行为?作为记录,数组的最后一个值似乎是被取消引用的值。

它使用字符串的 comma operator for an access,基本上是 returns o,并在两者之间做一些事情。

部分:

"eo"                        string
    [                       bracket operator/string accessor
     0,                     value 0
       g=()=>{},            generating an empty function
                g(),        call that function
                    g(),    call that function again
                        1   take 1 as the last element of comma operator
                         ]  return 'o'