freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/constructing-strings-with-v.../index.md

13 lines
537 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Constructing Strings with Variables
---
## Constructing Strings with Variables
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Add variables that store strings, to create longer strings. Make sure your spelling and spacing is right.
var myName = "Bobby";
var myFavLetter = "B";
var sentence = "Hello, I'm " + myName + ". My favorite letter is " + myFavLetter + ".";
//The result is "Hello, I'm Bobby. My favorite letter is B.