There’s all a dud item in the arrays for title and URL which I need to remove. It is always the first item in the array. So I’m looking for help on 2 transformations:
How do I remove the first item of the title and URL arrays? I couldn’t get .shift() to work.
How do I arrange the data per item rather than per property? My desired output format is:
slice will return array from element with index 1 (mean second element bc we start from 0) till end (unless given second parameter)
Read more here as needed: Array.prototype.splice() - JavaScript | MDN
I figure it out with looping:
Have a look at this and don’t hesitate to paste your JSON if you need help with any step
Slice works! I want to understand why splice worked and shift did not – is that because slice returns an array and shift does not? (And n8n needs an array to be returned to shift is not going to work in this case).
I am trying to achieve the same result as your loop using the map function. I can create individual items with a json property, but each item contains the full array of titles (not just 1). Would love to hear your pointers for the code below:
I didn’t know much about shift but after research, both will work. Shift does not return value so you need to just call method. I updated my prev. post but it would be like that