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.
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 ...