I never understand JavaScript | Infographic

I never understand JavaScript, I’m sure you can all relate.

Why is JavaScript the most confusing web programming language?

Because of this:

5 + 5 

You can tell me what this is, right? It’s 10, that’s right.

What about this?

5 + '5' 

This is '55'. Makes sense, right?

'5' + 5 

This is also '55'. This makes more sense than the last one, though, even though it still makes no sense.

5 + +'5' 

Now what’s this? This is 10 again.

'5' - - '5' 

This is also 10.


NaN === NaN 

This is false.

{} + []   === 0 [] + []   === '' [] * 1    === 0 false + 1 === 1 

These are all true.


typeof NaN === 'number' 

true! JavaScript, you’ve been exposed.


JavaScript can be so confusing. It’s not just type juggling you have to worry about. Also, speaking of type juggling:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.