Hi
I have the following code, and want to express the max points result in parallel with the winners names (i.e the two couples who got 7), What do i need to do to amend this code at the bottom?
[CODE]var contestantNamesArray = [‘bob and pete’, ‘tim and jon’, ‘mick and alun’, ‘van and brad’, ‘chez and jaz’];
var judgesPointsArray = [2,1,5,4,3];
var audiencePointsArray = [4,5,2,3,1];
var combinedPointsArray = new Array (5);
for (var points = 0; points < judgesPointsArray.length; points++)
{
combinedPointsArray[points] = judgesPointsArray[points] + audiencePointsArray[points];
}
var maxPoints = combinedPointsArray[0]
for (var points = 0; points < judgesPointsArray.length; points++)
{
if (combinedPointsArray[points] > maxPoints)
{
maxPoints = combinedPointsArray[points];
}
}
document.write(‘The maximum number of points was ‘ + maxPoints + ‘<BR>’)
document.write(‘The couple(s) scoring the maximum were:’ + ‘<BR>’)
[U]{
document.write(contestantNamesArray[maxPoints] );
}
[/U]
Thanks ?