JSFiddle - React, Tailwind, and code Playground
by swoogie
JavaScript
user_depts = [1, 2, 3, 4, 5, 6];
dept_ids = [1, 2, 3, 6, 7, 8];
depts = user_depts.filter(function (e) {
return dept_ids.indexOf(e) !== -1;
})
console.log(depts)
// python list comprehension for the lines 3-5
// depts = [d for d in user_depts if d not in dept_ids]