Câu hỏi phỏng vấn Angular
Câu hỏi

What are the utility functions provided by RxJS?

Câu trả lời

RxJS, or Reactive Extensions for JavaScript, provides a comprehensive set of utility functions that are essential for performing various operations on observables. These utility functions can be broadly categorized into creation operators, transformation operators, filtering operators, and utility operators. Each category serves a specific purpose in the handling and manipulation of streams of data.

Creation Operators

Creation operators are used to create new observables from various data sources or from scratch. Some of the common creation operators include:

  • of(): Converts the arguments into an observable sequence.
  • from(): Turns an array, promise, or iterable into an observable.
  • interval(): Creates an observable that emits a sequence of integers spaced by a given time interval.

Transformation Operators

Transformation operators are used to alter the data emitted by observables. Some key transformation operators are:

  • map(): Applies a given function to each item emitted by the source observable and emits the resulting values.
  • switchMap(): Projects each source value to an observable which is merged in the output observable, emitting values only from the most recently projected observable.
  • concatMap(): Maps each value to an observable, then flattens all of these inner observables using concatAll().

Filtering Operators

Filtering operators are used to select certain values from an observable based on specific criteria. Some commonly used filtering operators include:

  • filter(): Emits only those values from the source observable for which the provided function returns true.
  • take(): Emits only the first n values from the source observable and then complete...
middle

middle

Gợi ý câu hỏi phỏng vấn

middle

Why would you use a spy in a test?

expert

Do you know how you can run AngularJS and Angular side by side?

expert

Why Incremental DOM is Tree Shakable?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào