Chapter 2. Working with Objects
Everything in JavaScript is an object. This includes functions, arrays, and strings. There's also the notion of a plain object—a dictionary of key-value pairs. This latter structure is useful when you need support with looking up values by a key. In other words, something that a programmer would likely want to read—instead of a numerical index found in arrays.
Lots of APIs return JSON data—you'll often find plain objects. While you can achieve much using JavaScript objects on their own, Lo-Dash makes life easier for doing common things with objects. These functions make the mundane a little less boring as you'll soon find out, you can often find a less verbose approach to working with objects.
In addition to plain object access and manipulation, Lo-Dash has several utility functions that can be applied to any object in your code. These are mostly concerned with validating the type of object you're working with, a duplicitous task using Vanilla JavaScript.
In this chapter, we will cover the following topics:
- Determining an object type
- Assigning and accessing properties
- Iterating over objects
- Calling methods
- Transforming objects
- Creating and cloning objects