Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function flightSchedule(arr) {
- let fligthData = arr.shift();
- let status = arr.shift();
- let printStatus = arr.shift();
- let fligthList = {};
- let statusChange = {}
- for (let x = 0; x < fligthData.length; x++) {
- let all = fligthData[x].split(" ");
- let flightNumber = all.shift();
- let destontion = all.join(" ")
- if (!fligthList.hasOwnProperty(flightNumber)) {
- fligthList[flightNumber] = [];
- fligthList[flightNumber].push(destontion)
- }
- }
- for (let x = 0; x < status.length; x++) {
- let [statusNum, statusInfo] = status[x].split(" ");
- if (fligthList.hasOwnProperty(statusNum)) {
- fligthList[statusNum].push(statusInfo);
- }
- }
- let filter = Object.entries(fligthList).filter(([fligthNum, arr]) => arr.length > 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement