So I was a bit curious what would happen if an object was defined like {__proto__: p, x: 1, x: 2} and p had a setter for x, so I tested it real quick.
Turns out, even in that case, which is the only possible way I could think of to introduce side effects inside an object literal, JavaScript ignores the setter on the prototype and creates a data property on the new instance (which then also shadows the inherited accessor property from the prototype).
So no, as far as I can tell, a double assignment in an object literal will literally never have any semantic meaning.
So I was a bit curious what would happen if an object was defined like
{__proto__: p, x: 1, x: 2}andphad a setter forx, so I tested it real quick.Turns out, even in that case, which is the only possible way I could think of to introduce side effects inside an object literal, JavaScript ignores the setter on the prototype and creates a data property on the new instance (which then also shadows the inherited accessor property from the prototype).
So no, as far as I can tell, a double assignment in an object literal will literally never have any semantic meaning.
Can you show the code of the example?