Basic JavaScript (28/111) | Constructing Strings with Variables | freeCodeCamp

preview_player
Показать описание
Basic JavaScript (28/111) | Constructing Strings with Variables | freeCodeCamp

Sometimes you will need to build a string, Mad Libs style. By using the concatenation operator (+), you can insert one or more variables into a string you're building.

Example:

var ourName = "freeCodeCamp";
var ourStr = "Hello, our name is " + ourName + ", how are you?";
// ourStr is now "Hello, our name is freeCodeCamp, how are you?"