- RxJS Tutorial
- RxJS - Home
- RxJS - Overview
- RxJS - Environment Setup
- RxJS - Latest Updates
- RxJS - Observables
- RxJS - Operators
- RxJS - Working with Subscription
- RxJS - Working with Subjects
- RxJS - Working with Scheduler
- RxJS - Working with RxJS & Angular
- RxJS - Working with RxJS & ReactJS
- RxJS Useful Resources
- RxJS - Quick Guide
- RxJS - Useful Resources
- RxJS - Discussion
RxJS - Mathematical Operator Min
min() method will take in an observable with all values and return an observable with the min value. It takes in a compare function as an argument, which is optional.
Syntax
min(comparer_func?: number): Observable
Parameters
comparer_func − (optional). A function that will filter the values to be considered for min value from the source observable.If not provided the default function is considered.
Return value
The return value is an observable that will have the min value.
Example 1
import { of } from 'rxjs'; import { min } from 'rxjs/operators'; let list1 = [1, 6, 15, 10, 58, 2, 40]; let final_val = of(1, 6, 15, 10, 58, 2, 40).pipe(min()); final_val.subscribe(x => console.log("The Min value is "+x));
Output
The Min value is 1
Example 2
import { of ,from} from 'rxjs'; import { min } from 'rxjs/operators'; let list1 = [1, 6, 15, 10, 58, 2, 40]; let final_val = from(list1).pipe(min((a,b) => a - b)); final_val.subscribe(x => console.log("The Min value is "+x));
Output
The Min value is 1
Advertisements
To Continue Learning Please Login
Login with Google