I am trying to convert an observable stream to an array, with my current approach when the count reaches to 5 then I am getting the emitted value as an array.
Is there any way to get an array of the count each time interval emits a value. Like: [0], [0, 1], [0, 1, 2] and so on.
const interval$ = interval(1000);
interval$.pipe(
take(5),
toArray()
).subscribe({
next: (data) => {
// Emitting when count reaches to 5
console.log(data);
}
});