I was looking through some old downvoted questions, and I came across How to add 2 numbers in jQuery, and I saw that:
$(1)+$(2)="[Object object][Object object]"
So then tried to see what $(1)
put out, and it turned out to be [1]
, and likewise for $(2)
and [2]
.
Normally, when you try to add [1]+[2]
, it will give you "12"
, but if you add $(1) and $(2)
, it gives you "[object Object][object Object]"
.
What is the explanation for this behavior?