O'Reilly logo

Learn JavaScript with p5.js: Coding for Visual Learners by Engin Arslan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Engin Arslan 2018
Engin ArslanLearn JavaScript with p5.jshttps://doi.org/10.1007/978-1-4842-3426-6_8

8. Functions

Engin Arslan
(1)
Toronto, Ontario, Canada
 
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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required