Summary

Functions are the bedrock of interactive JavaScript on the World Wide Web. Because functions, combined with event handlers, allow for a delayed response based on the user’s action, they respond to an action and hence are interactive. So, virtually all events triggered by the user’s action are potential sources for launching functions and engaging the user in ways that a static web page cannot do alone.

For the most part, functions are built as independent objects and are launched by a triggering event. However, they can be treated as data and can be placed into variables for use in other statements, including other functions as arguments or a part of other objects. As such, functions can be treated as modular building blocks in an object-oriented ...

Get JavaScript Design 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.