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 trialPhillip Bailey
1,822 Pointsfunction call back, I have tried this many times and still can't get it.
Not sure what Im doing wrong. I tried to make a function so I can call it. Is that doing too much? Thanks.
const https = require('https');
https.get("https://teamtreehouse.com/chalkers.json");
function callBack(){
console.log("hello call back");
}
https.get("http://teamtreehouse.com/chalkers.json", callBack();
1 Answer
Steven Parker
231,236 PointsYou're getting close, but the instructions said to "pass in an anonymous function as a callback". An anonymous function would have no name and be defined right in the https.get
call.
Also, the instructions say the function should take "the parameter of response
.", but this function takes no parameters.
Finally, you should add the 2nd argument to the existing https.get
call, you won't need to call it a second time.