Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function companyUser(input){
- let users= {}
- input.forEach(line => {
- [company, employe] = line.split(" -> ")
- if(!users.hasOwnProperty(company)){
- users[company] = new Set()
- }
- users[company].add(employe)
- });
- let sorted = Array.from(Object.entries(users)).sort()
- .forEach(key=>{
- console.log(key[0])
- for(let el of key[1]){
- console.log(`--`,el)
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement