$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · hard · #132

Complete the function

// returns the deduplicated array preserving order
function dedupe<T>(arr: T[]): T[] {
  const seen = new ____<T>();
  return arr.filter(x => seen.has(x) ? false : (seen.add(x), true));
}

Answer: Set (also accepted: Set, Set())

A Set stores unique values and supports has()/add().
Play Problem Solving ▸