Data Structures: Arrays and Objects

"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' [...] I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question".

 – Charles Babbage, Passages from the Life of a Philosopher (1864)


Numbers, Booleans, and strings are the atoms that data structures are built from. Many types of information require more than one atom, though. Objects allow us to group values – including other objects – to build more complex structures.

The programs we have built so far have been limited by the fact that they were operating only on simple data types. This chapter will introduce basic data structures. By the end of it, you'll know enough to start writing useful programs.

The chapter will work through a more or less realistic programming example, introducing concepts as they apply to the problem at hand. The example code will often build on functions and bindings that were introduced earlier in the text.



Source: Marijn Haverbeke, https://eloquentjavascript.net/04_data.html
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 License.