In this video Emmanuel Henri explains a callback and its role into a function with an example.
- [Instructor] Another term that you may have heard…many times and not quite sure what it means…is the callback.…What is a callback and its role?…In its simplest terms, a callback function…is a function that is called inside of another function.…In other words, whenever you pass a function…in the arguments and run it inside this function…you're doing the callback pattern.…So let me demonstrate.…So let's continue working with this function here…and create a second function.…So let's go ahead and simply remove all this.…
And we'll create a second function called printCalc.…And this function will take callback as an argument.…We're simply putting a callback as an argument for now,…but we'll pass our function inside of it.…Opening curly braces, and then simply doing a log…inside of the function.…So what we'll do is use the function to pass…a callback function, and once inside of that function…the callback will be inserted inside of the console log.…
So what I will do is run the function that we pass…inside of our function here and therefore being a callback.…
- What's a pattern?
- What's the role of callbacks?
- Creational patterns, including Singleton and Factory
- Structural patterns, including model-view-controller
- Behavioral patterns, including Memento and Mediator
Skill Level Intermediate
2. Creational Patterns
3. Structural Patterns
4. Behavioral Patterns
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.