0

I have an object and it includes some arrays. I want to sort one array and other arrays should mirror the indexes of one array and they will be sorted according to this array. I need a javascript function. Thanks for your advance.

My object


var object= {
    a : [],
    b: [],
    c: []
  }

So when you sort an element a,b,c other items should mirror the indexes of one root array.

Similar functionality at python ==> https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sort_values.html

  • Welcome to Stack Overflow! Please take the [tour] (you get a badge!) and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Your best bet here is to do your research, [search](/help/searching) for related topics on SO, and give it a go. ***If*** you get stuck and can't get unstuck after doing more research and searching, post a [mcve] of your attempt and say specifically where you're stuck. People will be glad to help. – T.J. Crowder Jul 24 '20 at 10:34
  • Side note: Given what you've described, I'd recommend *not* using three arrays (unless of course you have a really good reason for doing so). Use a single array of objects with three properties (for the three values at that index) instead. That way, you never have to worry about the arrays getting out of sync. – T.J. Crowder Jul 24 '20 at 10:36

0 Answers0