Hey folks 👋!
Look at the code given below -
Strange isn't it? We declared
age variables. We didn't declare objects. So where are these methods and attributes coming from?
symbol. Their wrapper objects are
Boolean as follows.
Whenever this conversion from primitive to object happens, the objects are dumped after a single-use.
We are overriding
toUpperCase() and returning "toUppercase", still
toUpperCase() was not overridden. Do you know why? Yes because they are temporary. They are invoked when we are accessing functions in the prototype and dumped immediately.
I'd be coming with a follow-up article where we'd discuss what's need for autoboxing.
Thank You for reading!