Click to See Complete Forum and Search --> : +=


David Harrison
05-16-2003, 05:06 PM
If instead of writing:

text="Hi";
text=text+" There.";

I can write:

text="Hi";
text+=" There.";


Is there a similar way of writing:

text="There.";
text="Hi "+text;

khalidali63
05-16-2003, 05:24 PM
+ operator is overloaded in javascript.
and its default functionality is to concatenate to the right.
I am prety sure you end up doing

text = "Hi " + text;

David Harrison
05-16-2003, 05:30 PM
Ah well never mind, it would only have saved a few bytes at most.