I am working on a project in my javascript class and I am having trouble sorting parallel arrays. I have successfully sorted them alphabetically, however I also need to sort in ascending order. I have tried using a key to sort, but the professor said we are not allowed to alter the arrays given.I need to be able to sort the mnthCharge but keep the names and other data in line when they are sorted. Any pointers would be greatly appreciated!
var custName = new Array("Smith, Al","Toms, Andy","Jones, Zack","Vargas, Eddie","Donner, Alice","McMullen, Jessie","Nevins, Carol","Stark, Howard","Neeland, Franny","Boxby, Amos");
var mnthCharge = new Array(140.00, 42.00, 18.00, 18.00, 36.00, 140.00, 42.00, 24.00, 140.00, 24.00);
var pastDueAmt = new Array(0, 0, 84.00, 36.00, 0, 18.00, 42.00, 42.00, 96.00, 0);
var dayPastDue = new Array(0, 0, 60, 60, 0, 30, 90, 30, 120, 0);
function recurringCharges()
{
var d = [];
for(var i=0; i<custName.length; i++){
//d.push(['Customer': custName[i], 'Recurring': mnthCharge[i], 'Amount': pastDueAmt[i], 'Days': dayPastDue[i]]);
d.push([custName[i], mnthCharge[i],pastDueAmt[i],dayPastDue[i]]);
}
var sorted = d.sort();