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)