I need to make an api call with particular parameter.
See example below:
const apiFunc = (someId, anotherId) => apiCall(someId, anotherId) }
However in an array called someArr
I get something like [1, 'someId', 2, 'anotherId', 3, 'anotherId', 4, 'someId']
I need to use in apiCall()
if for example 1
(same as 4
) if 'someId'
is next to it, and 2
(same as 3
) if 'anotherId'
is next to it.
How can I properly format this please to achieve desired result?
Thanks
I have tried using .includes()
but without much success.