Word Blanks | = or += operator?

Tell us what’s happening:
var result = “”;
result+= " *strings + variables here* ";

I understand that the first line initializes the variable result. In the second line, this one is assigned a value (a sentence made out of strings and variables).
My question: why is it used += instead of just = in the solution? I can’t see the advantage of it.

Thanks!

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/word-blanks

I can’t see all the example code in the challenge because I’m on my phone. Did you add += part? Usually when they give you a variable like result you just give it the value. If that makes sense? So you would erase the “” and add your solution to result instead of leaving it a empty string

Hi Cody_Biggs,
What you wrote does make sense to me, but I was told that initialize variables this way is a good practice https://www.w3schools.com/js/js_best_practices.asp.
Also, var result = “”; is not deleted in the solution. And the += operator is used to assign var result the “new” value (which is a sentence made out of strings and variables) instead of the = operator only.
The code works fine with both operators, I’m just curious about why they decided to use one over the other.