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

David Aguirre
David Aguirre
7,264 Points

Error while executing the statuscode

Hello there , I have this piece of code running and I would like to know what exactly is not making it run.

I can't spot the error and also previously while executing it , it gave me an error message.

Thank you all!

const https = require("https")

const username = "chalkers" function printMessage (username, badgecount , point){

const message = ${username} has ${badgecount} total badge(s) and ${point} points in Javascript; console.log(message)}

const request = https.get(${username}.json, response => {

Brenden Seidel
Brenden Seidel
16,890 Points

David, I'd be glad to help. First, just a quick tip -- please use markdown to format your code in these comments -- makes it a lot easier to read :)

First, it looks like your function printMessage starts on the same line as your assignment for the username const. Either put the function on a new line (preferred) or add a semi-colon after "chalkers"

const username = "chalkers";
function printMessage (username, badgecount , point) {

Second, it looks like you're trying to create a template literal with the message const. Make sure to wrap that in back-ticks (). The same applies to the URL in thehttps.get()`` call.

const message = `${username} has ${badgecount} total badge(s) and ${point} points in Javascript`; 

Lastly, it looks like you're missing a right parentheses at the end of your https.get() call.