Sort a multidimensional array in JavaScript - Javascript jQuery

Javascript examples for jQuery:Array

Description

Sort a multidimensional array in JavaScript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.0.2.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from  w w  w .j av  a2  s. c  o  m
myArray = [
   [5,"Titel"],[3,"Titel"],[1,"Titel"],[2,"Titel"],[4,"Titel"]
];
console.log(myArray);
myArray=myArray.sort();
console.log(myArray);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials