Advertisement
bebo231312312321

Untitled

Mar 4th, 2023
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function piccolo(input) {
  2.     let parkingLIst = new Map()
  3.  
  4.     let carLine = input.map(el => el.split(', '))
  5.         .forEach(el => {
  6.             if (el[0] === "IN") { parkingLIst.set(el[1], el[0]) }
  7.             else if (el[0] === 'OUT') { parkingLIst.delete(el[1]) }
  8.         })
  9.         Array.from(parkingLIst)
  10.         .sort((a, b) => a[0].localeCompare(b[0]))
  11.         .forEach(x => console.log(x[0]));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement