I was watching a video that was shown to me by the user @CiganoMorrisonMendez
, called WAT .
There were some examples where they showed some bizarre things in some languages.
In particular what caught my attention was this line of JavaScript:
{} + [] // Resultado: 0
Adding a objeto
with a array
will return the value 0
. It may even seem clueless to this, but I want to know the explanation for this, since for this question there is also an explanation for the weirdness.
What is the reason for this behavior? I would like a step-by-step explanation of the above question.