Skip to content

Tag: object

How to simplify function which returns an object?

I have a function which returns an object but I don’t like that I gotta declare it first and then do forEach method I think there should be something like this But for some reason, it doesn’t work. PS: In this part — — I’m trying to create a key with a name separated by a dot (I …

Access Javascript Object Value with Dynamic Key

How do you handle accessing the objects inside a JSON response when the key is dynamic? In my code sample, I’ve created a reducer that makes API calls but requires params to work: That function works and it returns a response that gets deposited on fetch that looks like this: In my example response, all…

How to breakdown an array of objects?

I have an array of objects and i need to classify each object by name and then get the addition of some properties. To be more specific, I have a cart with some orders and i need to breakdown by product name so i can calculate how many items of that product were bought. That is the dummy data, I