: Is + always interpreted as string concatenation when one of the operands is a string?
A: Yes. However, because + has what is called left-to-right associativity, if you have a situation like this:
var order = 1 + 2 + " pizzas";
you’ll get “3 pizzas”, not “12 pizzas” because, moving left to right, 1 is added to 2 first (and both are numbers), which results in...
- 7. Types, Equality, Conversion and All That Jazz: Serious types
- Publisher: O'Reilly Media, Inc.
- Released: March 2014
What is the left associativity of + operator?