WHAT IS A FUNCTION?
Functions let you group a series of statements together to perform a specific task. If different parts of a script repeat the same task, you can reuse the function (rather than repeating the same set of statements).
Grouping together the statements that are required to answer a question or perform a task helps organize your code.
Furthermore, the statements in a ...
Get JavaScript and JQuery: Interactive Front-End Web Development 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.