January 2019
Beginner
210 pages
4h 47m
English
The max operator function can be used to find the biggest value in an observable. We must apply the max operator using the pipe method:
import { from } from "rxjs";import { max } from "rxjs/operators";const observable = from<number>([2, 30, 22, 5, 60, 1]);observable.pipe(max());const subscription = observable.subscribe( (value) => console.log(value));subscription.unsubscribe();
The following marble diagram showcases the initial sequence and the result sequence after applying the max operator:

The result sequence contains only one value (the biggest value in the original sequence).
Read now
Unlock full access