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 trialPetar Karagenov
8,608 PointsThe readableQuery const
The url Andrew Chalkley uses does not do what is shown on the video. The url given in the documentation looks like this: http://api.wunderground.com/api/${key}/conditions/q/CA/San_Francisco.json - it includes a state. So now the get function requires one more property and also gives the part //const query = process.argv.slice(2).join("").replace(' ', '');// a serious issue. I am stuck with that.
nico dev
20,364 PointsGreat answer!
If I could, I'd vote it best answer definitely!
1 Answer
Michael Braga
Full Stack JavaScript Techdegree Graduate 24,174 PointsWith destructuring assignment, you can also do this:
const [,, state, city] = process.argv;
var queryString = `https://api.wunderground.com/api/${api.key}/conditions/q/${state}/${city}.json`;
Caroline olijve
Courses Plus Student 14,499 PointsCaroline olijve
Courses Plus Student 14,499 PointsHi Petar , I had the same problem and fixed it by using:
and giving the function the two arguments:
weather.get(state,city);
I admit it is not very elegant, maybe someone found a prettier solution ?