DEV Community

Discussion on: JS Spec debunking for toPrimitive on an object

Collapse
 
bendtherules profile image
Abhas Bhattacharya

Nice post.
2 small suggestions -

  1. 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

  2. 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.

Collapse
 
lakbychance profile image
Lakshya Thakur

Thanks for the suggestions. Updated the post :)

Some comments have been hidden by the post's author - find out more