set20

Filter blocked users out of a chat list

20 / 26
read the snippet · pick its Big-O
// blocked is an array, not a Set.
function visibleUsers(users, blocked) {
const out = [];
for (const u of users) {
if (!blocked.includes(u.id)) out.push(u);
}
return out;
}