I was just reading YDKJS up and going. And here are something I wanna understand.
Which means that the all the 5 primitive types of value are immutable. But, object is mutable.
The primitive types boolean, string and number can be wrapped by their object counterparts.
Which means that we can do something like this:
But can we do something like this?
However here is an example I found online and here are some of my questions:
typeof true; //"boolean" typeof Boolean(true); //"boolean" typeof new Boolean(true); //"object" typeof (new Boolean(true)).valueOf(); //"boolean"
I don’t understand the last two line of code. What does it mean? Is
new Boolean(true); a function? And the last line of the code, why it returns “boolean” ?? Could someone explain what does all these mean?