Unit 3. Functions

Functions are a pretty fundamental construct for authoring applications. This is especially true in a language like JavaScript, which treats functions as first-class citizens. With ES2015 and later, many awesome features have been added to functions, including several completely new types of functions.

We’ll start the unit by taking a look at default parameters and rest. I think most programmers, at some point, have had the need for default parameters and likely worked around it by checking for a value and assigning one if undefined at the start of the function. The rest param is even more useful. Anyone who has used the arguments object before will be happy to use rest. Not only does rest render the arguments object obsolete, ...

Get Get Programming with JavaScript Next now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.