Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort array based on another array

arr.sort((a, b) =>{  
	return sortingArray.indexOf(a) - sortingArray.indexOf(b);
});
 
PREVIOUS NEXT
Tagged: #sort #array #based #array
ADD COMMENT
Topic
Name
1+9 =