> I still find the difference between assigning and defining very subtle. I am 
> still trying to fully wrap my head around it.
> 
> The best way to think about it is to think of how innerHTML works. If you 
> "define" a property called "innerHTML", it would pave over the existing 
> innerHTML and all of the semantics would be lost. When you "assign" to 
> elem.innerHTML, the accessor semantics handle updating the DOM with the value 
> given as the AssignmentExpression on RHS.
> 
> Hopefully that helps?

Thanks. With properties, we are missing the clarity that we have with 
variables: You can’t assign to an undeclared variable (in strict mode). With 
properties, assignment “auto-declares” if there is no own property and no 
setter. So things are less clear.

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to