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

Latest comments (0)

Let's Get Wacky


Use any Linode offering to create something unique or silly in the DEV x Linode Hackathon 2022 and win the Wacky Wildcard category

β†’ Join the Hackathon <-