JavaScript Essentials: functions are fun (and VIP) — if you understand them

Imagine you live in a village without tap water. To get water, you need to take an empty bucket, head to the well in the middle of the village, draw water from the well, and head back home.

You need to draw water from this well multiple times a day. It’s a hassle to say “I’m going to take an empty bucket, go to the well, draw water and bring it back home” every time you explain what you’re doing.

To shorten it, you can say you’re going to “draw water.”

And, my friend, you’ve created a function.

Source: JavaScript Essentials: functions are fun (and VIP) — if you understand them