It's probably better not to call it as Symbol.toPrimitive(obj) - someone might think that is a runnable code, but what you meant is the ToPrimtive abstract method
I think it's ok to skip the assert statements - it's probably there because the same function/algo can be called from multiple places and this will ensure that it is always called correctly. It doesn't change the algo itself.
Nice post.
2 small suggestions -
It's probably better not to call it as
Symbol.toPrimitive(obj)
- someone might think that is a runnable code, but what you meant is the ToPrimtive abstract methodI think it's ok to skip the assert statements - it's probably there because the same function/algo can be called from multiple places and this will ensure that it is always called correctly. It doesn't change the algo itself.
Thanks for the suggestions. Updated the post :)