Bummer! You must be logged in to access this page.

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 trial

JavaScript

Callback closure promises...

Hi i'm a little confuse, what is the difference between: - callback function - recursive functions - closures - promise All those concept look a bit like the same for me and i don't understand in which case are we using anyone of them.

2 Answers

Steven Parker
Steven Parker
243,318 Points

Here are some thumbnail definitions:

  • a callback function is a function expression passed as an argument to another function to be called later
  • a recursive function is a function that calls itself (under certain conditions)
  • a closure is a function that encloses another function (and variables) to create a private "scope"
  • a promise is an object that represents the eventual completion (and value) of an asynchronous process

These are some pretty advanced concepts, so even these definitions may not make much sense. But as you continue in your studies, you will get to points in the courses where you will get more detailed explanations and also see examples of how they are used.

Thanks a lot, it really helped, i couldn't put a word on those different concept, couldn't have done better than you did.