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

9. Objects

Engin Arslan1 
Toronto, Ontario, Canada

JavaScript contains a data structure called Objects. Objects help you organize code and they make it easier to work with in certain cases. There are two ways of creating objects: by using an object initializer or by using constructor functions. In this chapter we’ll create a single object using an object initializer, while constructor functions act as a blueprint from which we can create many object instances using the new keyword.

Using Object Initializer

JavaScript uses a data structure called Object that helps organize data together. There are a couple of ways of creating an object ...

Get Learn JavaScript with p5.js: Coding for Visual Learners now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.