last operator emits the last value of observable stream.
last
import { interval } from 'rxjs'; import { last, take } from 'rxjs/operators'; const source$ = interval(1500).pipe(take(2)); const result$ = source$.pipe(last());
Official Doc: rxjs.last