This commit is contained in:
Ilya Kantor 2017-06-04 01:14:41 +03:00
parent c90377d996
commit 3cd2bcd48c
3 changed files with 29 additions and 5 deletions

View file

@ -211,7 +211,7 @@ For instance:
```
```smart header="Historical notes"
For historical reasons, methods `toString` or `valueOf` *should* return a primitive: if any of them returns an object, then there's no error, but the object is ignored (like if the method didn't exist).
For historical reasons, methods `toString` or `valueOf` *should* return a primitive: if any of them returns an object, then there's no error, but that object is ignored (like if the method didn't exist).
In contrast, `Symbol.toPrimitive` *must* return an primitive, otherwise there will be an error.
```