The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Utility operator: do

Utility operator: do

4:25
We just saw map which is a transformation operator. There are a couple of categories of operators, such as filtering, combination, flattening, etc. One of these categories is the utility operators. The most important utility operator is `do`, useful for debugging.
Watch this lesson now
Avatar
egghead.io

We just saw map which is a transformation operator. There are a couple of categories of operators, such as filtering, combination, flattening, etc. One of these categories is the utility operators. The most important utility operator is do, useful for debugging.

Avatar
Sam

May I ask why the both do functions outputted before the actual map function e.g you got 'before, after, next' on your console logs rather than 'before, next, after' even though the functions were chained in the order .do > .map > .do ?

In reply to egghead.io
Avatar
Andre

Hi Sam, that sequence of logs is due to .do > ... > .do > .subscribe. The map itself doesn't cause any console log, it is subscribe that cause a console.log.

In reply to Sam
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?