PHP's Dot Equals `.=` operator in Javascript?
How can you use PHP's Dot Equals .= operator in开发者_运维知识库 Javascript?
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";
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 += ',';
use += eg:
a = 'Hello'
a += 'World'
var a = "";
a += "fff";
加载中,请稍侯......
精彩评论