Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics Working with Strings Combine Strings and Template Literals Review

i need help with this quiz

I don't get what to put in the fill the blanks question

What is the question?

Steven Parker
Steven Parker
231,275 Points

There's more than one "blanks" question in this quiz.

3 Answers

+=

Consider the following code:

let greeting = 'Hi';
greeting = greeting + ', Treehouse students!';

Complete this code by adding the operator that produces the same result as the above code:

let greeting = 'Hi';
greeting **+=** ', Treehouse students!';

Reason:The addition assignment operator adds the value of the right operand (the stuff on the right side of the =) to a variable and assigns the result to the variable. 

Link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators#Addition_assignment

Complete the code below to create a template literal:

const headline =  **` **<h1>A Literal Headline</h1> **` **;

Consider the following code:

const name = "Aneesah";
let message = "Hello " + name + ". How are you?";

Complete the code below to recreate the above code using template literal interpolation:

const name = "Aneesah";
let message = ** `Hello ${name}. How are you?` **;

Reason: Template literals are enclosed by the backtick ()  (grave accent) character instead of double or single quotes. Template literals can contain placeholders - indicated by the dollar sign and curly braces (${expression}). The expressions in the placeholders and the text between the backticks () get passed to a function.

The default function just concatenates the parts into a single string. 

Link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

+= and += didn't work. What's the correct stuff to put in the blank space? Here's the Quiz Question again:

Consider the following code:

let greeting = 'Hi'; greeting = greeting + ', Treehouse students!'; Complete this code by adding the operator that produces the same result as the above code:

let greeting = 'Hi'; greeting ', Treehouse students!'; <----fill in blank space after greeting

https://teamtreehouse.com/library/javascript-basics/working-with-strings/combine-strings-and-template-literals-review