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 trialKevin Gonzales
4,638 PointsCan someone go over Completion?
I do not fully understand what happens when we do this completion(currentWeather). Could someone elaborate?
also this statement let currentWeather = self.currentWeatherFromJSON(JSONDictionary)
what is the self referring to in here?
Kevin Gonzales
4,638 PointsThanks! I think I get it better!
Kevin Gonzales
4,638 PointsI can't give a best answer for some reason tough
1 Answer
Frank Novello
19,299 Pointsseriously...very frustrating..
Brian Patterson
19,588 PointsI to am finding this very frustrating.
Erwin Gaitan Ospino
3,102 PointsErwin Gaitan Ospino
3,102 Pointswhat completion(currentWeather) does is executing the function that we pass to getForecast when we call it. For example:
So, basically when we call the network.getForecast method, the function that we pass to it, won't be executed until completion(currentWeather) is executed. This is known as a callback.