Basic JavaScript (29/111) | Appending Variables to Strings | freeCodeCamp

preview_player
Показать описание
Basic JavaScript (29/111) | Appending Variables to Strings | freeCodeCamp

Just as we can build a string over multiple lines out of string literals, we can also append variables to a string using the plus equals (+=) operator.

Example:
var anAdjective = "awesome!";
var ourStr = "freeCodeCamp is ";
ourStr += anAdjective;
// ourStr is now "freeCodeCamp is awesome!"
Set someAdjective and append it to myStr using the += operator.

Рекомендации по теме