为什么关联数组不关联的时候叫关联数组?

Why are associative arrays called associative when they are not associative?

运算 * 是结合的当且仅当 (A*B)*C = A*(B*C)。对于*关联数组的访问操作,是非关联的:

考虑一个关联数组,表示为 json:

A = { B: { C: D } }

我们有:(A.B).C = D

但是:A.(B.C) is undefined

我也尝试过其他操作,如添加等。没有任何关联。

(如果您想尝试,维基百科不会提供答案;)

Associative as in associative arrays有不同的含义,这是相对于如何获取元素:

  • 非关联数组:您只存储可以使用索引检索的值 (Array[5])
  • 关联数组:将值关联到键,然后可以使用键检索值(Array['MyKey'])。