JavaScript Node.js Basics Building a Command Line Application Capturing Command Line Arguments

Why not working? My code is perfect.

Why isn’t this working? It should be perfect.

ERROR MESSAGE: “SyntaxError: Unexpected token”


const https = require('https');

function printMessage(username, badgeCount, points) { const message = ${username} has ${badgeCount} total badge(s) and ${points} in JavaScript ; console.log(message); }

function getProfile(username){

const request = https.get(${username}.json, response => { let body = ""; response.on('data', data => { body += data.toString(); });

response.on('end', () => { const profile = JSON.parse(body); printMessage(username, profile.badges.length, profile.points.JavaScript); });



getProfile("chalkers"); getProfile("alenaholligan");

1 Answer

Dave StSomeWhere
Dave StSomeWhere
19,783 Points

I'm pretty sure that there is no such thing as perfect code. hehe

Don't you at least need tics for your template code?

Steven Parker
Steven Parker
173,522 Points

If there was "perfect" code, you'd never have to ask why it wasn't working. :smirk: