javascript - adding the values in an array

  • From: "Lamar Upshaw" <lupshaw@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 26 Oct 2007 09:21:21 -0700

Ok, here's an easy one for someone, although difficult for me! lol *smile*

I have an array in javascript:
num = New array(0,1,2,3,4);

I want to have a variable that has the added total of the values in the num

total = 10;

How do I get javascript to add the values in the array and put them in to a
variable?  I've tried both the while and for loops, but it seems the value
of a variable in the loop, only applies while in the loop.

With All Respect,
Upshaw, LaMar T

View the list's information and change your settings at 

Other related posts: