Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Wednesday at 8:16 PM
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Tuesday at 10:57 AM
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Tuesday at 10:55 AM
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Tuesday at 10:53 AM
Canva Pro Lifetime Own Mail Activation LKR 500
sayuru bandara
Updated:
Tuesday at 10:51 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Software Development
Arrays දෙකක, එක සමාන elements හොයා ගන්නේ කොහමද ??
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Seven Net" data-source="post: 25425682" data-attributes="member: 497416"><p>මම API එකකින් response එක ගන්නවා. එකේන්, මේ පහල විධියට arrays 2ක් එක්ක response එක එනව. </p><p></p><p>[CODE=json]routesOutput: [{origin_iata: "CMB", destination_iata: "IST",…}, {origin_iata: "CMB", destination_iata: "SAW",…}]</p><p> 0: {origin_iata: "CMB", destination_iata: "IST",…}</p><p> 1: {origin_iata: "CMB", destination_iata: "SAW",…}</p><p>schedulesOutput: [{departure_iata: "CMB", arrival_iata: "MLE",…}, {departure_iata: "MLE", arrival_iata: "IST",…},…]</p><p> 0: {departure_iata: "CMB", arrival_iata: "MLE",…}</p><p> 1: {departure_iata: "MLE", arrival_iata: "IST",…}[/CODE]</p><p></p><p>[ATTACH]80485[/ATTACH]</p><p></p><p>මේකේ, routesOutput කියන array එක ඇතුලේ weekly කියල තව array එකක් තියෙනව. ඒක ඇතුලේ flight_ids කියල එකක් තියෙනව. මේ පහල විධියට. </p><p></p><p>* routesOutput[0].schedules.weekly[0].flights.flight_ids</p><p></p><p>[CODE=json]routesOutput: [{origin_iata: "CMB", destination_iata: "IST",…}, {origin_iata: "CMB", destination_iata: "SAW",…}]</p><p> schedules: {updated: {}, weekly: [{routing_id: "159058258847310869390999", frquency: [1, 1, 0, 1, 1, 0, 1],…},…]}</p><p> weekly: [{routing_id: "159058258847310869390999", frquency: [1, 1, 0, 1, 1, 0, 1],…},…]</p><p> 0: {routing_id: "159058258847310869390999", frquency: [1, 1, 0, 1, 1, 0, 1],…}</p><p> technical_stops: "MLE"</p><p> flights: {flight_ids: ["159058258847310869501898", "159058258847310869627899"]}</p><p> flight_ids: ["159058258847310869501898", "159058258847310869627899"]</p><p> 0: "159058258847310869501898"</p><p> 1: "159058258847310869627899"[/CODE]</p><p></p><p>ඒ වගේම, schedulesOutput කියන array එක ඇතුලේත් flight_ids කියල තියේනව. මේ පහල විධියටම. </p><p></p><p>* schedulesOutput[0].flights.flight_ids</p><p></p><p>[CODE=json]schedulesOutput: [{departure_iata: "CMB", arrival_iata: "MLE",…}, {departure_iata: "MLE", arrival_iata: "IST",…},…]</p><p> 0: {departure_iata: "CMB", arrival_iata: "MLE",…}</p><p> flights: [{flight_ids: "159058258847310869501898", operating_iata: "TK",…},…]</p><p> 0: {flight_ids "159058258847310869501898", operating_iata: "TK",…}</p><p> flight_ids: "159058258847310869501898":[/CODE]</p><p></p><p>මට ඕන, මේ routesOutput හා schedulesOutput කියන arrays දෙකේ තියේන flight_ids සමාන වෙනවද කියල බලලා, ඒ flight id එකට විතරක් අදාල technical_stops එක console කර ගන්නයි.</p><p></p><p>මම මේ, පහල විධියට කරත්, මට ඕන දේ වෙන්නේ නැ. මම කොහමද මේක හදා ගන්නේ ??</p><p></p><p>[CODE=javascript]let routesMap = await schedulesAdd.mapSchedules();</p><p> let routesOutput_let = routesMap.routesOutput;</p><p> let schedulesOutput_let = routesMap.schedulesOutput;</p><p> let routes_with_weekly = routesOutput_let[0].schedules.weekly;</p><p> let flights_from_schedule = [];</p><p> let route_with_flight_ids = [];</p><p> let schedule_with_flight_ids = [];</p><p></p><p> routes_with_weekly.forEach(routes_with_weekly_element => {</p><p> let test_one = routes_with_weekly_element.flights.flight_ids</p><p> route_with_flight_ids.push(test_one);</p><p> });</p><p></p><p> schedulesOutput_let.forEach(schedulesOutput_let_element => {</p><p> let test_two = schedulesOutput_let_element.flights;</p><p> flights_from_schedule.push(test_two);</p><p> });</p><p></p><p> flights_from_schedule.forEach(flights_from_schedule_element => {</p><p> let test_two_point_one = flights_from_schedule_element[0].flight_ids;</p><p> schedule_with_flight_ids.push(test_two_point_one);</p><p> });</p><p></p><p> for(let i = 0; i < route_with_flight_ids.length; i++) {</p><p> if(schedule_with_flight_ids != undefined) {</p><p> if(route_with_flight_ids[i][0] == schedule_with_flight_ids[i]) {</p><p> console.log(route_with_flight_ids[i][0]);</p><p> }</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="Seven Net, post: 25425682, member: 497416"] මම API එකකින් response එක ගන්නවා. එකේන්, මේ පහල විධියට arrays 2ක් එක්ක response එක එනව. [CODE=json]routesOutput: [{origin_iata: "CMB", destination_iata: "IST",…}, {origin_iata: "CMB", destination_iata: "SAW",…}] 0: {origin_iata: "CMB", destination_iata: "IST",…} 1: {origin_iata: "CMB", destination_iata: "SAW",…} schedulesOutput: [{departure_iata: "CMB", arrival_iata: "MLE",…}, {departure_iata: "MLE", arrival_iata: "IST",…},…] 0: {departure_iata: "CMB", arrival_iata: "MLE",…} 1: {departure_iata: "MLE", arrival_iata: "IST",…}[/CODE] [ATTACH]80485[/ATTACH] මේකේ, routesOutput කියන array එක ඇතුලේ weekly කියල තව array එකක් තියෙනව. ඒක ඇතුලේ flight_ids කියල එකක් තියෙනව. මේ පහල විධියට. * routesOutput[0].schedules.weekly[0].flights.flight_ids [CODE=json]routesOutput: [{origin_iata: "CMB", destination_iata: "IST",…}, {origin_iata: "CMB", destination_iata: "SAW",…}] schedules: {updated: {}, weekly: [{routing_id: "159058258847310869390999", frquency: [1, 1, 0, 1, 1, 0, 1],…},…]} weekly: [{routing_id: "159058258847310869390999", frquency: [1, 1, 0, 1, 1, 0, 1],…},…] 0: {routing_id: "159058258847310869390999", frquency: [1, 1, 0, 1, 1, 0, 1],…} technical_stops: "MLE" flights: {flight_ids: ["159058258847310869501898", "159058258847310869627899"]} flight_ids: ["159058258847310869501898", "159058258847310869627899"] 0: "159058258847310869501898" 1: "159058258847310869627899"[/CODE] ඒ වගේම, schedulesOutput කියන array එක ඇතුලේත් flight_ids කියල තියේනව. මේ පහල විධියටම. * schedulesOutput[0].flights.flight_ids [CODE=json]schedulesOutput: [{departure_iata: "CMB", arrival_iata: "MLE",…}, {departure_iata: "MLE", arrival_iata: "IST",…},…] 0: {departure_iata: "CMB", arrival_iata: "MLE",…} flights: [{flight_ids: "159058258847310869501898", operating_iata: "TK",…},…] 0: {flight_ids "159058258847310869501898", operating_iata: "TK",…} flight_ids: "159058258847310869501898":[/CODE] මට ඕන, මේ routesOutput හා schedulesOutput කියන arrays දෙකේ තියේන flight_ids සමාන වෙනවද කියල බලලා, ඒ flight id එකට විතරක් අදාල technical_stops එක console කර ගන්නයි. මම මේ, පහල විධියට කරත්, මට ඕන දේ වෙන්නේ නැ. මම කොහමද මේක හදා ගන්නේ ?? [CODE=javascript]let routesMap = await schedulesAdd.mapSchedules(); let routesOutput_let = routesMap.routesOutput; let schedulesOutput_let = routesMap.schedulesOutput; let routes_with_weekly = routesOutput_let[0].schedules.weekly; let flights_from_schedule = []; let route_with_flight_ids = []; let schedule_with_flight_ids = []; routes_with_weekly.forEach(routes_with_weekly_element => { let test_one = routes_with_weekly_element.flights.flight_ids route_with_flight_ids.push(test_one); }); schedulesOutput_let.forEach(schedulesOutput_let_element => { let test_two = schedulesOutput_let_element.flights; flights_from_schedule.push(test_two); }); flights_from_schedule.forEach(flights_from_schedule_element => { let test_two_point_one = flights_from_schedule_element[0].flight_ids; schedule_with_flight_ids.push(test_two_point_one); }); for(let i = 0; i < route_with_flight_ids.length; i++) { if(schedule_with_flight_ids != undefined) { if(route_with_flight_ids[i][0] == schedule_with_flight_ids[i]) { console.log(route_with_flight_ids[i][0]); } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Winadiyakata thappara keeyak tibeda?
Post reply
Top
Bottom