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

am trying to run the code but i cant figure out whats wrong

const https = require('https') const username = "chalkers"; function printMessage(username,badgeCount,points) {

const message = '${username} has ${badgeCount} total badges and ${points} points in javaScript';

console.log(message); } const request = https.get('https://teamtreehouse.com/${username}.json'),response => { console.dir(response); }

1 Answer

Steven Parker
Steven Parker
229,732 Points

The template strings appear to be enclosed with the wrong symbols:

const message = '${username} has ${badgeCount} total badges and ${points} points in javaScript';
// and
https.get('https://teamtreehouse.com/${username}.json')

For template interpolation, the string must be enclosed using accent symbols (also called "backticks") instead of apostrophes.

And for future questions, please use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:   Or watch this video on code formatting.