Abstract
Functions are primary building blocks of JavaScript. They allow us to write programs in a more efficient and scalable manner. Functions help us to manage complexity by containing and grouping operations under a single executable name. We already know how to call functions by using the p5.js predefined functions such as ellipse or background. We even declared our own functions as p5.js forces us to put our code into two function declarations: setup and draw. If we wanted to create our own functions, we would follow the same convention we have been using for the creation, or declaration, of these functions.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Engin Arslan
About this chapter
Cite this chapter
Arslan, E. (2018). Functions. In: Learn JavaScript with p5.js. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3426-6_8
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3426-6_8
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3425-9
Online ISBN: 978-1-4842-3426-6
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books