👉 Comparator is a function that compares two elements and returns an appropriate value based on their equality or inequality. It's used in programming to compare elements of different data types (like integers, strings, etc.) for comparison purposes. The terms "comparators" are often used interchangeably with "comparers".