> For the complete documentation index, see [llms.txt](https://soufatn.gitbook.io/rxjs-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soufatn.gitbook.io/rxjs-book/summary/observable/observable_instance_methods/distinct.md).

# distinct

Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer. Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.

## Arguments

1. `[keySelector]` *(`Function`)*: A function to compute the comparison key for each element.
2. `[keySerializer]` *(`Function`)*: Used to serialize the given object into a string for object comparison.

## Returns

*(`Observable`)*: An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.

## Example

### Without key selector

### With key selector
