Hi,
Im getting and error in firefox saying that total is not defined, However
i think it is in blue. i understand the return statement concept just not how it works in conjuction with arrays.
any help?
function sum(numbers)
{
if (numbers.length ==0) return 0;
for ( var i=0, total=0;i <numbers.length; i++)
total+= numbers[i];
return total;
}
document.getElementById("txtTotal").value = total;



Reply With Quote


Bookmarks