From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext

Unlock this course with a free trial

Join today to access over 25,000 courses taught by industry experts.

Use built-in object functions

Use built-in object functions

- Earlier in the course, we learned about how JavaScript objects were basically just key value hashes that we can use to store and manage related pieces of data. In addition to all the other details we've covered about objects, JavaScript provides us with some nice utility functions that we can use to work with objects more easily. These functions are found on JavaScript's built-in Object with a capital O Object that can be accessed from anywhere inside our JavaScript programs. Let's take a look at a few of these functions and how we can make use of them in our programs. The first utility function we're going to look at is Object.keys. What this function does is when we call on an object, it returns an array of all the objects keys or property names. And this is a really useful function since it allows us to sort of examine objects when we're not sure exactly what properties they're supposed to contain. For example, let's say that we had an array of people objects for all of the…

Contents