以下是正常的 javascript 语义:
js> a={'a':{'red':12,'green':23,'blue':34}}
({a:{red:12, green:23, blue:34}})
js> b=a['a']
({red:12, green:23, blue:34})
js>b={red:122, green:232, blue:142}
({red:122, green:232, blue:142})
js> a
({a:{red:12, green:23, blue:34})
js>
以下是我想要的语义:
js> a={'a':{'red':12,'green':23,'blue':34}}
({a:{red:12, green:23, blue:34}})
js> b=a['a']
({red:12, green:23, blue:34})
js>b={red:122, green:232, blue:142}
({red:122, green:232, blue:142})
js> a
({red:122, green:232, blue:142})
js>
是否有任何简单的内部技巧可以让 javascript 以我的方式行事?