Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript sort array by column

/*//*\___________________l4r3f4c3@proton.me________________/|**/
/**/  Array.prototype.sort2d = function(column) {              //
/**/  column = typeof column === "undefined" ? 0 : column      // 
/**/  return this.sort((a, b) => a[column]-b[column]); }       //
/**/  const unsorted2DArray = [[3,1,1,1],[9,3,3,3],[6,2,2,2]]  //
/**/  sorted2DArray = unsorted2DArray.sort2d()                 //
/**/  //sorted2DArray = [ [3,1,1,1],[6,2,2,2],[9,3,3,3] ]      //
/*//*======================/*//*/=========================/||*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular online editor 
Javascript :: appendchild element once if element present in js 
Javascript :: jquery find attribute from siblings 
Javascript :: abstract class in js 
Javascript :: //Splice remove and add new elements in an array in javascript 
Javascript :: Get google maps getplace lat and long 
Javascript :: what is state in react 
Javascript :: filter data from object 
Javascript :: run code in javascript 
Javascript :: jade cdn 
Javascript :: javascript ajax receive multiple values 
Javascript :: print js example 
Javascript :: make input bigger if text does not fit 
Javascript :: joi.validate is not a function stack overflow 
Javascript :: json parse 
Javascript :: flex slider 
Javascript :: fibbanacci sequence 
Javascript :: setstate 
Javascript :: window.open function 
Javascript :: currying javascript 
Javascript :: math module js 
Javascript :: get all a tags javascript 
Javascript :: on close tab react native web 
Javascript :: how to give args type in nestjs graphql for array of input 
Javascript :: convert javascript to ruby 
Javascript :: json concat 
Javascript :: jsdoc object destructuring 
Javascript :: javascript dom after a element 
Javascript :: jquery class 
Javascript :: .reduce mdn 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =