# freeCodeCamp Challenge Guide: Constructing Strings with Variables

**URL:** <https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805>\
**Category:** freeCodeCamp Contributors\
**Tags:** guide\
**Created:** [July 3, 2016, 4:15am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805 "2016-07-03T04:15:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![camperbot](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/camperbot/32/18364_2.png) [@camperbot](https://forum.freecodecamp.org/u/camperbot)\
**Post date:** [July 3, 2016, 4:15am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805/1 "2016-07-03T04:15:18Z")

</div>

# [Constructing Strings with Variables](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables)

* * *

## Hints

### Hint 1

Add variables that store strings, to create longer strings. Make sure your spelling and spacing is right.

```javascript
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.

```

---

<div class="post-metadata">

**Author:** ![caseydev](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/caseydev/32/77001_2.png) [@caseydev](https://forum.freecodecamp.org/u/caseydev)\
**Post date:** [July 7, 2017, 10:39am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805/2 "2017-07-07T10:39:06Z")

</div>

var myName = “Kumar”;  
var myStr = "My name is " + myName + “and I am swell!”;

> > you can set your name in myName variable

---

<div class="post-metadata">

**Author:** ![anon52159105](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@anon52159105](https://forum.freecodecamp.org/u/anon52159105)\
**Post date:** [August 6, 2017, 11:19pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805/3 "2017-08-06T23:19:58Z")

</div>

Closed on August 6, 2017, 11:19pm UTC



---

<div class="post-metadata">

**Author:** ![camperbot](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/camperbot/32/18364_2.png) [@camperbot](https://forum.freecodecamp.org/u/camperbot)\
**Post date:** [August 10, 2019, 1:18am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805/4 "2019-08-10T01:18:41Z")

</div>

Opened on August 10, 2019, 1:18am UTC



---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 7, 2025, 12:00pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-constructing-strings-with-variables/16805/5 "2025-01-07T12:00:46Z")

</div>

Closed on January 7, 2025, 12:00pm UTC


