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
Copy file name to clipboardExpand all lines: 1-js/04-object-basics/05-object-toprimitive/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,7 +164,7 @@ There is no control whether `toString()` returns exactly a string, or whether `S
164
164
The only mandatory thing: these methods must return a primitive, not an object.
165
165
166
166
```smart header="Historical notes"
167
-
For historical reasons, if `toString` or `valueOf` return an object, there's no error, but such value is ignored (like if the method didn't exist). That's because in ancient times there was no good "error" concept in JavaScript.
167
+
For historical reasons, if `toString` or `valueOf` returns an object, there's no error, but such value is ignored (like if the method didn't exist). That's because in ancient times there was no good "error" concept in JavaScript.
168
168
169
169
In contrast, `Symbol.toPrimitive` *must* return a primitive, otherwise there will be an error.
0 commit comments