*Note from the Editor: Links and content of this post has been revisited December 2013. The original cite has been outdated. However you might find the content still valuable if you are, say a Javascript coder with some Java OOP backend.
String Concatenation in Flash, clearly explained by Mr. Francis Chengfrom Adobe.
An excerpt:
String Concatenation in Flash, clearly explained by Mr. Francis Cheng
An excerpt:
To understand this issue, we need to see the expression from the compiler's point of view. To the compiler, the expression:
"Hello" + + " world"is actually the following:
"Hello" + ( + " world")
So the short answer for those of you familiar with operator precedence rules is that the compiler first evaluates the expression (+ " world"), which yields NaN.
The compiler then evaluates the expression "Hello" + NaN, which yields "HelloNaN". The reason for the compiler error is that in Strict Mode, ActionScript 3.0 does not allow the application of the the unary "+" operator to a value of type String.
You'll get "HelloNaN" as the result if you turn off Strict Mode. If this makes little or no sense to you, read on for a more detailed explanation.