@pratiksharm
Well, thank you for opening a good discussion. I am afraid its technically not a good idea to call everything in JS an object. Even though we've got object wrappers to make certain methods work flawlessly on primitives, its still better to keep the difference well lit. Such assumptions can lead to mistakes where someone would try assigning a property to some primitive expecting it to be retrievable which in this case will misfire :)
Correct. 5 !== new Number(5). Values and references aren't exactly the same. For most purposes, you can treat everything like an object in JS, but it's nuanced.
@pratiksharm Well, thank you for opening a good discussion. I am afraid its technically not a good idea to call everything in JS an object. Even though we've got object wrappers to make certain methods work flawlessly on primitives, its still better to keep the difference well lit. Such assumptions can lead to mistakes where someone would try assigning a property to some primitive expecting it to be retrievable which in this case will misfire :)
Correct.
5 !== new Number(5)
. Values and references aren't exactly the same. For most purposes, you can treat everything like an object in JS, but it's nuanced.I mean, primitives get
Object
methods, so....@baenencalin Hey! I just tried to make this a little more clear in this post
I see. And it's a great post.
:)