Zhorzh

Untitled

Jan 24th, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. const getDepartments = (users=[]) => {
  2. return users.reduce((acc, user) => {
  3. if(!acc.includes(user.department)){
  4. acc.push(user.department)
  5. }
  6. return acc
  7. },[])
  8. }
  9. // console.log(getDepartments(employees))
Advertisement
Add Comment
Please, Sign In to add comment