Multi dimensional sort

by Rich Costello

JavaScript

var shapes = [
	[5, "Pentagon"],
  [3, "Triangle"],
  [8, "Octagon"],
  [4, "Rectangle"],
];

shapes.sort(function(a, b)
{
	return a[0] - b[0];
});

alert(shapes);