Functions Are Just Variables
Get an overview of JavaScript as first-class entities, enabling their storage in arrays or objects like any other variable type, facilitating dynamic invocation and usage throughout code.
We'll cover the following
Functions as first-class entities
Functions in JavaScript are considered to be first class, meaning they are treated like any other variable we can make use of. This allows us to store functions as items in an array or as properties in an object.
Let’s see how this plays out in practice. Here we have four variables, each of them functions, that complete some operation on two numbers:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy