How to verify the existence of a given array in another array?

Asked

Viewed 61 times

1

At a certain point in my system, I need to consume a method that returns an array, which can contain arrays.

I need to feed a second array with data contained in array leading. See example?

arrayRetorno[0] = item[i].tasks[0].colleagueId;

Some cases may occur that the array tasks do not exist, so how to check if there is a array task contained in the array item?

  • You have to do if ne... Try to do this: !! item[i]. tasks

  • If it is the tasks which may not exist so what you want to do is if (item[i].tasks) { ...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.