You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the above two constants the following expression will always return true.
john.age + five === ({name: 'John', age: 30}).age + (5)
This above statement isn't true; while john is declared as a constant; that only means that john can't be replaced with a different object, not that its fields can't be modified. A simple john.age = 10 would cause the above expression to return false, despite the definition of john as a constant.
The text was updated successfully, but these errors were encountered:
I think it could be fixed by saying it's referentially transparent for non-symbol primitives, the result of calling Symbol.for("global-symbol"), and the result of calling any pure function that only returns one of these.
From the section on constants:
This above statement isn't true; while
john
is declared as a constant; that only means thatjohn
can't be replaced with a different object, not that its fields can't be modified. A simplejohn.age = 10
would cause the above expression to return false, despite the definition ofjohn
as a constant.The text was updated successfully, but these errors were encountered: