Loading
Current section: 6. Object Methods 4 exercises
lesson

Intro to .object-methods

Loading lesson

Transcript

00:00 Alright. Now we're gonna talk about object methods. There are a bunch of methods that you can perform on the object and they are quite useful. So, with arrays, you actually called the methods right on the array itself. So you had your array one two three and then say array dot map and whatever.

00:19 With these object methods, we're actually going to be calling them on the object, class. It's not exactly a class. It's kind of a class. But, yeah. So these are static methods that are available on this object which is a global variable that you have access to everywhere.

00:34 And so here we got object dot keys, values and entries. And the reason I'm and also from entries. And the reason I'm teaching you these after we learned the array methods is because these actually turn your objects into arrays. So it becomes a lot more useful once you have a really good understanding of how arrays work. So, yeah.

00:53 Keys will basically just get all the keys of the object. Tada. That's it. Values will get all the values of the object. Amazing.

01:00 Entries will give you an array of arrays where the first entry in each array is the key and the second entry is the value. And then you can turn that, the set of array pairs into an object using from entries. So we're gonna do exercises for all of this. I'm excited for you to join me. Let's jump into it.