Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function piccolo(input) {
- let parkingLIst = new Map()
- let carLine = input.map(el => el.split(', '))
- .forEach(el => {
- if (el[0] === "IN") { parkingLIst.set(el[1], el[0]) }
- else if (el[0] === 'OUT') { parkingLIst.delete(el[1]) }
- })
- Array.from(parkingLIst)
- .sort((a, b) => a[0].localeCompare(b[0]))
- .forEach(x => console.log(x[0]));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement