DEV Community

Discussion on: JavaScript’s Primitive Wrapper Objects (the hidden feature)

Collapse
 
rohtashsethi profile image
Rohtash Sethi

Hi Abdel, nice content. However, seems like the first example and the underlying content doesn’t match. Apart from that i have one query, do these primitive wrapper objects are Mutable?

Collapse
 
abdelrahmanahmed profile image
Wahdan • Edited

Hi Rohtash, sorry for the confusing, I updated the example. Regarding your question, Objects, in general, are mutable, so primitive wrapper objects are considered mutable as well, but even if you tried to modify it, it will be useless and you will not notice it because javascript performs these steps when primitive wrapper are created:

Create an object of a corresponding type.
Call a specific method on the instance.
Delete the instance immediately.