Exercise - Higher-order Function Operator
Exercise
- Open exercise on codesandbox.
- Create a new higher-order function named
verifyPasscode
.
The first argument is the passcode
that is an array of number
values.
The second argument is optional, and is the timeout
that defaults to 1000 milliseconds.
- Return a function that accepts the
source
Observable
- Return the
source
Observable, and within the pipe()
method use the window
operator to open a window that will be closed when the source
Observable emits a next notification.
Use the debounceTime()
operator to debounce values from the source Observable for the specified timeout
.
- Use the
mergeMap()
operator to validate the next notification values emitted by the Observable that the window()
operator creates.