There is an array

var mass = [ ['tv', 500], ['mobile', 300], ['car', 10000] ]; 

How to sort it, by the second value of each array, what would happen?

 var mass = [ ['mobile', 300], ['tv', 500], ['car', 10000] ]; 

    1 answer 1

     mass.sort(function (a, b) { return a[1] - b[1]; });