Hi, Is it possible find the same rid from array to array2 then push the wordspin values inside the array variable but i can’t use .find as it result to error.
Yesterday I wrote a script to transpose vertical table to horizontal and stuck into object grouping task, which is similar to yours.
After your post I understood that I went wrong way, and how to solve my puzzle ))
So let’s help with yours.
besides grouping, you have other challenge - add new object properties according to those already existing. If wordspin2 property already exists, wordspin3 should be added and so on…
I belieive it has other easier solutions, maybe with spread+destruct, but I would use map array and transform to object.
group objects by Id is a standard task which have a lot of ways to do.
I took this reducer from net and changed a bit, to add just ‘wordspin’ properties and to get an ‘array of arrays’ on exit const group=(arr,key,val)=>arr.reduce((res,el)=>((res[el[key]]=[...(res[el[key]]||[]),el[val]]),res),[])
now we need to connect these two ‘data processors’