DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Angular - Array destructuring
Sandro Jhuliano Cagara
Sandro Jhuliano Cagara

Posted on • Updated on

Angular - Array destructuring

It's better to use array destructuring for some rxjs operators.

Instead of this:

return zip(paramOne$, paramTwo$).pipe(
     map((data) => { if(data[0]) {...} ...)})
);
Enter fullscreen mode Exit fullscreen mode

You can do it by this:

return zip(paramOne$, paramTwo$).pipe(
     map(([paramOne, paramTwo]) => { if(paramOne) {...} ...)})
);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Need better DEV posts?

You can set your approximate experience level in settings which can help improve the relevance of your DEV Home Feed.