Код: Выделить всё
var base = null;
var prop = {
toString: function() {
throw new Error("property key evaluated");
}
};
base[prop] += 2;
< /code>
Это поведение предполагает, что база преобразуется в объект до того, как индекс будет преобразован в строку. But the ECMAScript specification...
https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation
https://tc39.es/ecma262/#sec-property-accessors-runtime-semantics-evaluation
https://tc39.es/ecma262/#sec-evaluate-ccess-access-with-expression-key
https://tc39.es/ecma262/#sec-topropertykey
/>https://tc39.es/ecma262/#sec-putvalue
...seems четко это? Topropertykey (propertynamevalue) Подробнее здесь: https://stackoverflow.com/questions/796 ... fined-base