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 trialNadine Schermerhorn
2,324 PointsI'm trying to store in the var "request" the result of this get request. I'm getting errors.
With this code, I'm getting errors stating that I'm not declaring the var request" correctly. Is it looking for something specific that has to do with Node?
var http = require("http");
var request = "";
http.get("http://teamtreehouse.com/chalkers.json", function(response){
request = console.log(response.statusCode);
return request;
});
2 Answers
Steven Parker
231,275 PointsIt's simple variable assignment (nothing specific to node).
The challenge wants you to assign your variable with the result passed back from the get request:
var request = http.get("http://teamtreehouse.com/chalkers.json", function(response){
console.log(response.statusCode);
});
Essentially, you just add "var request =
" to what was already there.
Nadine Schermerhorn
2,324 PointsThank you.