-5
**PHP String Operators**
(.) Concatenation
(.=) Concatenation assignment

Function of a Concatenation assignment below.

var1 = "Helo";
var1 .= "World!";
echo var1;

The output above would be Helo World!

Q: Is there a similar operator like Concatenation assignment in javascript?

thanks.

I am looking for a Concatenation assignment not Assignment Operators, I ask for it because I do not know what it looks like, how would i know that += there was a concatenation operator? it only says assignment operator. And if you insist that it has a duplicate, then that link would be tittle something like concatenation... not assignment..., because assignment is very far similar than concatenation. Give my points back, I earned it hard!

3
  • 3
    would of been quicker to search, than type the question Commented Feb 13, 2014 at 1:39
  • Let me clarify this to you. String assignment is var = "string";, concatenation is var = "string"; var +="string2";. Commented Feb 13, 2014 at 1:48
  • 2
    diden even follow the link did you, or else you would have seen test += arr; Commented Feb 13, 2014 at 1:50

4 Answers 4

2

Javascript concatenation assignment is += and the corresponding concatenation operator +.

var var1 = "Hello,";
var1 += " world!";
Sign up to request clarification or add additional context in comments.

1 Comment

Hm, I was answering the question that was in the title (more or less, "Does JavaScript have the PHP concatenation assignment .="); someone must have edited it. I'll update.
1

Yes I believe there is, take a look at the += operator in the javascript console.

Comments

1

Yes, there is, but the concatenation operator is + not ..

Comments

1

Yes it's +=

E.g

var a = 'hello'
a += ' World1'
>>"hello World1"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.