Archive for January 20th, 2009

Javascript map-sort

I’m sure sorting method has a real name, but I’ve had no luck searching for it.
function mapSort(array, mapFunction, sortFunction)
{
    // Store both original value, and transformed value
    var mapData = array.map(function(e)
    {
        return [e, mapFunction(e)];
    });
   
    // Sort the data using the second element of [...]

Posted by Matthew on January 20th, 2009

Filed under javascript, programming | No Comments »