Update article.md

typo
This commit is contained in:
Mau Di Bert 2019-05-23 07:34:36 -03:00 committed by GitHub
parent 9f7235d4eb
commit d421e02db1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,7 +164,7 @@ There is no control whether `toString()` returns exactly a string, or whether `S
The only mandatory thing: these methods must return a primitive, not an object. The only mandatory thing: these methods must return a primitive, not an object.
```smart header="Historical notes" ```smart header="Historical notes"
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. 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.
In contrast, `Symbol.toPrimitive` *must* return a primitive, otherwise there will be an error. In contrast, `Symbol.toPrimitive` *must* return a primitive, otherwise there will be an error.
``` ```