Functions are first class objects in JavaScript. They're one of the key features that differentiates JavaScript from a class based language.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Class: JavaScript Functions


Functions are first class objects in JavaScript. That means we can create them on the heap, pass them as parameters and even return them from other functions. In this class, you'll learn the concepts and vocabulary required to master JavaScript functions. You'll be able to write more powerful programs and understand source code faster.

What's in this class?

  • Functions are First Class - Functions are first class objects in JavaScript. In this video you'll see what that means.

  • Creating Functions - In this video we'll create functions in a few different ways. You'll see the difference between "create" time and "call" time. We'll explore the resulting function objects, their inheritance chain, and the ability to call methods on functions using Function.prototype.

  • Functions are Reference Types - Functions in JavaScript are assigned as reference types. We demonstrate this by creating a function on the heap and assigning it to a multiple different variables and properties of objects. We then look at what happens when you take one function and pass it to another function as an argument.

  • Working with Function Arguments - We take a deeper look at function arguments by covering argument assignment, named arguments and the arguments object. We also cover how to take the arguments object and convert it into an array in order to iterate over the arguments by using the forEach method.

  • What Does "this" Mean? - In this video I'll show you what "this" points to inside of our function bodies.

  • Creating and Calling Functions - Having a good picture of when functions are created vs when they are called is really important to understanding the next topic of scope. In this video we'll dive into a few ways to create functions and look at the difference between create time and call time.

  • Introducing Scope - Understanding scope is critical to understanding many JavaScript patterns. In this video I'll show you a few examples of where scope is used, and how to think about scope.

  • Understanding Scope Chains - Variables in JavaScript are looked up using a Scope Chain, just like object property prototype chains. In this video you'll get a good intuition about what the scope chain is.

  • Function Closures - You can create new scopes using a function closure.

  • Scope Follows a Function - After a function is created, its scope follows it around until the function is destroyed. You'll see how this can be used in practice.

  • Functional Patterns - In this video I'll show you a few common functional patterns used in JavaScript including private scope, synchronous and asynchronous callbacks, and iterators.