JavaScript Node.js Basics Building a Command Line Application Making a GET Request with https

What is this syntax? I don't know about this...please help

What is the javascript ${username} means? And why these strings use the javascript ` mark?

const message = `${username} has ${badgeCount} total badge(s) and ${points} points in Javascript.`

Anyone could help?

1 Answer

Eric Butler
Eric Butler
31,918 Points

Hi Tseng, The back-ticks (those angled single-quote marks) indicate that this is a "template literal". It's a feature in ES6 that allows you to write multi-line strings and embed variables into the string like you see here. That's actually what the ${username} is: it's how to embed the variable, username, into the template literal string.