5
Arrays, Objects, and Modules
In this chapter you will learn how to use JavaScript arrays, and we illustrate their use with BoneScript to make Morse code signals using the built-in LEDs. You will also be introduced to JavaScript’s concept of “objects,” which provides a very powerful but unusual mechanism for object-oriented programming.
image
Arrays
The variables you have encountered so far have only had a single value. JavaScript arrays are used to contain a list of values. You can think of an array as being rather like a stack of pigeonholes. You can take something out of a particular location, using its index position. In this case, 0 is used to ...

Get Programming the BeagleBone Black: Getting Started with JavaScript and BoneScript 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.