Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getDepartments = (users=[]) => {
- return users.reduce((acc, user) => {
- if(!acc.includes(user.department)){
- acc.push(user.department)
- }
- return acc
- },[])
- }
- // console.log(getDepartments(employees))
Advertisement
Add Comment
Please, Sign In to add comment