Transcript
00:00 Alright. Let's jump into this example. We've got our price by SKU and we're gonna get all of our entries. So object entries is a method. We pass the price by SKU.
00:09 This is gonna give us an array of SKU price pairs. So that's gonna be SKU to the price. If we add that console log right here, you'll see it's an array of arrays. Yeah. So we've got that reminds me of that meme Yo dog, I heard you like arrays.
00:27 So you put your arrays in your arrays? I don't know. But, yeah. So we can do some interesting things with this. So now we can do a for of loop if we wanted to, and, and iterate like we do with regular arrays, which is kinda nice.
00:40 I I like arrays. I feel like it's a really good data model for interacting with a collection of objects, which is what it's for. So here we wanna create discounted entries with 10% off rounded to the nearest whole number. So we're gonna take our entries. We'll map that.
00:57 So for each one, we're going to, keep the SKU. That's fine. We wanna hang on to that, but we wanna change the price. We're gonna round that to a 90%, or or a 10% discount, so 90% of what its actual price is. We're using math.
01:13 Round, for that. You don't have to. You could leave it to just this. This is just what the AI did. I think math.round makes sense though, so I'm gonna leave that in there.
01:22 And then, we'll take our from entries method. So this is going to make us a new object from an array of arrays. So once you have that array of arrays, you can use from entries to turn that back into an object. And with the discount prices, then we get a 90%, version of the previous prices. And that is your entries and then you can map and do whatever you want and then from entries, which is kinda nice.
01:53 Pretty big fan of these methods. So good job doing this one, and, hope you really enjoyed it.
