• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to sort two dimentional array in javascript

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I need to sort a two dimentional array in javascript. I has a array a[] which contains another array b[4] of length 4.I need to sort array a[] according to array b[1]. ie i need to sort according to a[x][1] and then display that array a[].Can anyone suggest me how to do this.If possible please show with little example.
Thanks
Sruthi
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorting algorithms in JavaScript will be no different than in any other language. You're bound to find hundreds of thousands sorting algorithms with a simple search.
 
sruthi reddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i Have a Array
var a=[
["name1","01/10.2008","1/01/2008","xyz1"],
["name2","01/10.2008","1/01/2008","xyz2"],
["name3","01/10.2008","1/01/2008","xyz3"],
...
...
["nameN","01/10.2008","1/01/2008","xyzN"]
];

i need to sort this array according to date feild i,e according to cloumun 2 i,e accordint to date
 
My cellmate was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic