Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as JavaScript by arash ( 7 years ago )
function union(a1, a2, keyFor = x => x) {
    const a1seen = Object.fromEntries(a1.map(x => [keyFor(x), true]));
    return [...a1, ...a2.filter(y => !a1seen[keyFor(y)])];
}

 

Revise this Paste

Your Name: Code Language: