| id | max | ||
|---|---|---|---|
| mainCompare | reduce | ||
| lesson | 26 | ||
| compare |
|
||
| title | How the RxJS "max" operator works under the hood (scan, reduce) | ||
| learnAbout | count | ||
| learnBackAbout | reduce | ||
| layout | default | ||
| class | post | ||
| image | max/scanreducemax.gif | ||
| preview_image | max/content_preview.jpg | ||
| preview_image_alt | scan, reduce, max |
This is how a ❚ max operator would operate with an input stream:
- When the input stream completes, the output stream:
- emits the largest value emitted on the input stream
- and immediately completes
Some reactive stream libraries (eg. RxJS) provide this ❚ max operator, while others don't. How would you code max yourself?
In RxJS, ❚ min and ❚ max accept on optional comparer function as an argument.
For example:

{:.w300}