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

Back ticks in treehouse workspaces JUST FOUND OUT! :)

I was starting on while loops lets make random numbers, messing around with it and Treehouse workspaces let's you use the back ticks and ${} in its coding IDE. Pretty awesome!

check it out here at he bottom of my code.

var upper = 10000;

var randomNumber = getRandomNumber(upper);

var guess;

var attempts = 0;

function getRandomNumber(upper) {
  return Math.floor( Math.random() * upper ) + 1;
}
while(guess !== randomNumber){
guess = getRandomNumber(upper);
  attempts +=1;
}
//back ticks and ${} used below
document.write(`The random number was ${randomNumber} and it took the computer ${attempts} try's to get the number right.`);

1 Answer

Steven Parker
Steven Parker
243,266 Points

Those are template literals, and they are covered in the Getting Started With ES2015 course. There's also two workshops devoted to them: Introducing Template Literals and Practice Template Literals.

awesome I had no idea they did those yet. which I think those couple courses on down from where i'm at in JavaScript.

Steven Parker
Steven Parker
243,266 Points

Michael Fazekas — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!