All exercises

Dedupe an array

IntroJavaScript

Runs entirely in your browser — your code never leaves your machine.

Problem

Return a new array with duplicate values removed, keeping the order in which each value first appeared. The input is not mutated. dedupe([3, 1, 3, 2, 1]) → [3, 1, 2]

Related cheat sheet
Your code
Press Run tests to check your solution.