toArray
signature: toArray(): OperatorFunction
toArray(): OperatorFunction방출되는 값들을 모은 후, 소스 옵저버블 구독이 완료되면 배열형태로 내보냅니다.
예시
// RxJS v6+
import { interval } from 'rxjs';
import { toArray, take } from 'rxjs/operators';
interval(100)
.pipe(
take(10),
toArray()
)
.subscribe(console.log);
// 결과: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]관련된 사용법
추가 자료
Last updated
Was this helpful?