Skip to Content
JavaScript for Kids
book

JavaScript for Kids

by Nick Morgan
December 2014
Beginner content levelBeginner
336 pages
6h 32m
English
No Starch Press
Content preview from JavaScript for Kids

Chapter 8. Functions

A function is a way to bundle code so that it can be reused. Functions allow us to run the same piece of code from multiple places in a program without having to copy and paste the code repeatedly. Also, by hiding long bits of code in a function and giving it an easy-to-understand name, you’ll be better able to plan out your code because you can focus on organizing your functions rather than all of the little code details that make them up. Splitting up your code into smaller, more manageable pieces allows you to see the bigger picture and think about how your programs are structured at a higher level.

You’ll find functions really useful when you need to repeatedly perform a calculation or action throughout a program. Earlier ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaScript For Kids For Dummies

JavaScript For Kids For Dummies

Chris Minnick, Eva Holland
JavaScript Projects for Kids

JavaScript Projects for Kids

Syed Omar Faruk Towaha

Publisher Resources

ISBN: 9781457189838Errata Page