How can you use PHP's Dot Equals .=
operator in Javascript?
views:
456answers:
4
A:
I assume that the .=
operator is used for string concatenation?
In Javascript the +
operator is used for string concatenation, and the +=
operator for reassigning the string to the same variable. Example:
s += ',';
Guffa
2010-01-01 12:19:48
+4
A:
What you are mentioning is a contatenation equals operator which sets the value of the left hand operand to a string containing a concatenation of its value appended with the string in the right hand operand.
You can do the same operation in javascript using the +=
operator.
var str = "test";
str += " appended string";
rahul
2010-01-01 12:20:36