set18

Dedupe a signup list — the fast version

18 / 26
read the snippet · pick its Big-O
function dedupeByEmail(users) {
const seen = new Set();
const out = [];
for (const u of users) {
if (!seen.has(u.email)) {
seen.add(u.email);
out.push(u);
}
}
return out;
}