Quote:
Originally Posted by WolfShade
I am not sure, but I don't think var name = "data" +
"more data" +
"even more"; is valid or good JS.
|
WHAT???
Pardon, but how did you come by that belief?
Of course it's both valid and good JavaScript.
The + operator, whether used to really do arithmetic addition or string concatenation, returns the added/concatenated value as its result. So of course you can then add or concatenate further.
If you don't think that's legal, look at this:
http://www.codingforums.com/showpost...2&postcount=10
Look at the next to last statement in all that JS code.
Code:
NewCode = topR + midR + name + ": " + sign +" "+ plevel
+ "<BR> XP: "+ (EXP-showxp)
+"<BR> Experience needed: " + (xpup-EXP)
+ "<BR>Overall Experience:" + (xneeded * EXP / xneeded)
+"<br><!-- placeholder --><br><br>"
(It's not very good HTML, but it's perfectly legal and correct JavaScript code.)