Advertisement
bebo231312312321

Untitled

Mar 17th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function flightSchedule(dataFly) {
  2.     let flyInfo = {}
  3.     let firstList = dataFly.shift()
  4.     let secondList = dataFly.shift()
  5.     let thirtList = dataFly.shift()
  6.     firstList.forEach(flyLine => {[flyNumber, destination] = flyLine.split(" ");
  7.         flyInfo[flyNumber] = {
  8.             Destination: destination,
  9.             Status: "Ready to fly"
  10.         }
  11.     })
  12.     secondList.forEach(secondInfo => {[flyNumber, Status] = secondInfo.split(" ")
  13.         if (flyInfo[flyNumber] !== undefined) {
  14.             flyInfo[flyNumber].Status = Status
  15.         }
  16.     })
  17.     for (let fly in flyInfo) {
  18.         if (flyInfo[fly].Status == thirtList) {
  19.             console.log(flyInfo[fly])
  20.         }
  21.     };
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement