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 trialDamian Szymanski
11,843 PointsIs there any documentation for the api() {} method used here?
Hi! I was wondering if there was any documentation for the api() {} method that's used here as I would like to understand it further.
Thanks!
2 Answers
Motoki Higa
14,111 PointsI know it's late, but I had a some question in the beginning of the course, but api() is essentially a custom helper method, so there is no official document about the function/method. You can name the function whatever, and you can customise the function however you like to suite for your purpose!
Soufiane Ez Zine
Full Stack JavaScript Techdegree Graduate 17,754 PointsAs Motoki Higa explained, It also took me a little while to get around it, then I realized that the whole Data class is there to simplify things, api()
is just a customized method made by whoever wrote the course to make things easier and avoid having to send fetch requests over and over again with different URLs and parameters.