Unit 2. Objects and arrays
Objects and arrays have always been the workhorse of JavaScript, acting as the go-to data structures for organizing data. Even with the additions of maps and sets, which you’ll learn about in unit 5, objects and arrays aren’t going anywhere and will still be used just as much as before.
Notice how I referred to objects and arrays as data structures. With literals, you can easily structure your data into complex structures that would be tedious to describe without literals. The inverse has always been missing. You probably never even noticed its absence, but once you see how awesome it is to be able to destructure your data as easily as you structure it, you may begin to feel handicapped anytime you have to go back to doing it the old way. Destructuring is one of my favorite new additions to JavaScript, and for good reason. You’ll find yourself using it everyday to make your code easier to read and write. But before you jump to destructuring, we’ll take a look at some useful new methods being added to objects and arrays. We’ll also look at some welcome additions to object literals thst make them even more powerful than before.
Finally, we’ll look at a completely new primitive data type, symbols. Symbols are commonly used to define what I call “meta behavior(s)”—hooks to alter or define the behavior of existing functionality. They can also be used to avoid the sorts of naming collisions you might run into with strings.