Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

Callback Functions in JavaScript Course (How To)

via Treehouse

Overview

Callback functions are a foundational concept in JavaScript. Callbacks are used in timers, user interaction events, loading data from a server, and used in Node.js.

Whether you're a budding front end or back end developer, callbacks are everywhere!

What you'll learn

  • Learn the syntax of using callbacks
  • What anonymous functions are
  • How to use anonymous functions as callbacks
  • Use one-off and repeat times
  • Use callbacks for user interaction

Syllabus

Introduction to Callback Functions

In this stage we'll look at what callback functions are, why you'd use them, and the types of callback functions you can use.

Chevron 8 steps
  • Why Callback Functions?

    4:47

  • What is a Callback?

    3:06

  • Identifying Callbacks

    5 questions

  • Creating a Simple Callback Function

    3:42

  • Using a Function as a Callback

    1 objective

  • Anonymous Functions

    2:14

  • Anonymous Function as Arrow Functions

    1:58

  • Creating an Anonymous Callback Function

    1 objective

Callbacks with Timers

In this stage we'll use callbacks with timers. There are two sets of timers: one-off timers and repeat timers.

Chevron 6 steps
  • Using a One-Off Timer with setTimeout

    3:26

  • Using Anonymous Functions with setTimeout

    1:36

  • Using a Repeat Timer with setInterval

    2:27

  • Using Anonymous Functions with setInterval

    1:33

  • Review: Timers

    5 questions

  • Triggering an Animation

    1 objective

Callbacks and the DOM

In this stage we'll cover callbacks in the context of the Document Object Model. Here we'll take a look at some from input field events.

Chevron 6 steps
  • Callbacks with Arguments

    3:07

  • Using Callbacks on Text Inputs

    4:26

  • Using the Same Callback on Multiple Elements

    2:30

  • Conclusion

    1:31

  • Callbacks with DOM Elements

    1 objective

  • Review: Callbacks

    8 questions

Reviews

Start your review of Callback Functions in JavaScript Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.