Referencelast
Reference · 71
last
last
Takes the last value before complete.
Signature
last(predicate?: (value: T) => boolean, defaultValue?: D): OperatorFunction
What it does
Remembers the last matching value and emits it only after the source completes. It can take a predicate and a defaultValue.
When to use
The final result of a finite sequence, the last event of a batch process, the last valid step.
Gotcha
On an infinite stream, last never emits, because it waits for complete.
See also
first, takeLast
script.ts
CONSOLE · Console output
Hit Run to see the result...