• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Rearrange array elements from the updated indexing array

Resolved: Rearrange array elements from the updated indexing array

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I don’t really know how to explain my problem so sorry for the title.
I have three JavaScript arrays:
With that array, I want to get the new order of the originalPos array by using newData array like this :
The goal is to be able to change the position of my waypoints in the Leaflet Routing Machine using L.routing.machine.spliceWaypoints()

Answer:

You can rearrange by finding the position of every element of originalPos in originalData and with that respective position you can push the element from newData into the result array.
Assuming there is no duplicate data within all three arrays


If you have better answer, please add a comment about this, thank you!

arrays javascript leaflet
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to compare two text files and and change the sign of the data in powershell?

27/03/2023

Resolved: Java Virtual Machines deleted

27/03/2023

Resolved: PyCharm cannot see my newly compiled .pyc see on import

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.