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

Zach Freitag
Zach Freitag
18,828 Points

Why not working? My code is perfect. https://teamtreehouse.com/workspaces/33084322#

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

ERROR MESSAGE: “SyntaxError: Unexpected token” https://teamtreehouse.com/workspaces/changelog

MY CODE BELOW:

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(https://teamtreehouse.com/${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
16,263 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
143,271 Points

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