Beta
Implement Merge operator from RxJS
Description:
Create a basic Merge operator from RxJS library using JavaScript. This operator will combine multiple Observables into a single Observable, emitting values from all source Observables concurrently.
Requirements
- Implement the merge operator to combine multiple source Observables into a single Observable.
- Ensure that the operator follows RxJS conventions and integrates seamlessly with existing Observables.
Note
The Observable-like class has already been implemented inside the kata.
So you are able to use new Observable
, pipe
, of
, interval
Usage example
const source1$ = Observable.of(1, 2, 3);
const source2$ = Observable.of(4, 5, 6);
// Also possible:
// const source2$ = new Observable(observer => { observer.next(1) });
const merged$ = merge(source1$, source2$);
merged$.subscribe({
next: value => console.log(value),
error: err => console.error('Error:', err),
complete: () => console.log('Completed')
});
// Output: 1 2 3 4 5 6 Completed
Have fun!😀
RxJS
Reactive Programming
Reverse Engineering
Similar Kata:
Stats:
Created | Sep 18, 2024 |
Published | Sep 20, 2024 |
Warriors Trained | 12 |
Total Skips | 0 |
Total Code Submissions | 26 |
Total Times Completed | 4 |
JavaScript Completions | 4 |
Total Stars | 1 |
% of votes with a positive feedback rating | 50% of 2 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 2 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |