+ operator JavaScript

Here there are some question regarding to + operator javascript as bellow:

* What does “3”+4+5 evaluate to?

Since 3 is a string, everything is a string, so the result is 333

* What does 3+5+”6” evaluate to?

Since 3 and 5 are integers, this is number arithmetic, since 6 is a string, it’s concatenation, so 36 is the result.

Leave a Reply