Chapter 8

Writing and Running Functions

IN THIS CHAPTER

Bullet Writing and naming functions

Bullet Passing arguments to functions

Bullet Returning values from functions

Bullet Making anonymous functions

Bullet Using arrow functions

Bullet Writing functions in objects

Bullet Understanding this and context

Bullet Linking functions in a chain

“What I do has to be a function of what I can do, not a function of what people ask me to do.”

—TIM BERNERS-LEE

Functions are the objects that make your programs do things. They also serve an important organization purpose: Just as objects organize data into reusable containers, functions organize statements into reusable functionality.

A function is a group of statements that perform a task. In other ...

Get JavaScript All-in-One For Dummies 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.