Skip to content

Tag: arrays

How can I remove a number of objects in an array?

I have an array like this : I only want two of each of category object in the array and remove the rest If the number of objects of that category is over 2 and get something like this : How can I remove the rest of the objects of a specific category If the number of those objects in

Looping over an object to change values inside

I am trying to send an object to an api and my object contains arrays that I want to turn into strings. However I am having trouble returning the new object with the arrays turned to strings. My goal is to have a copy of the original object with all the arrays turned into strings. Answer You are not assigning