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

Blake Runyon
seal-mask
.a{fill-rule:evenodd;}techdegree
Blake Runyon
Full Stack JavaScript Techdegree Student 7,539 Points

Template Literals

Why is the kicking an error?

const name = prompt ( "What is your name?");
const message = `Hello: ${name}. It's ${2 * 3}PM. `;
alert ( message );
Steven Parker
Steven Parker
231,153 Points

If this is for a challenge, please provide a link to the challenge page.

2 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,850 Points

It looks like your message isn't in a literal, should be:

const message = `Hello: ${name}. It's ${2 * 3}`

Notice the tick marks.

Steven Parker
Steven Parker
231,153 Points

The font change implies tick marks were used, but Markdown formatting was not applied to display them correctly.

As a mod, you should be able to fix the formatting. :see_no_evil:

Blake Runyon
seal-mask
.a{fill-rule:evenodd;}techdegree
Blake Runyon
Full Stack JavaScript Techdegree Student 7,539 Points

Hey Steve - If I write mine, then yours they look similar?

const message = `Hello: ${name}. It's ${2 * 3}PM. `;
const message = `Hello: ${name}. It's ${2 * 3}`
Steven Parker
Steven Parker
231,153 Points

It looks better now with the formatting added (either by you or Clayton). But it could be that the code is good yet doesn't meet the objective. Please provide a link to the challenge and we can check it out.

Steven Parker
Steven Parker
231,153 Points

You are just typing these lines into the browser JavaScript console? What error do you get?

Or do you mean the workspace console? If that's it, you can't enter JavaScript code there. You'd need to create a web project and then "preview" it.