Adding numbers inside an array

I am generating an array dynamically with numbers. When I loop through the array, I’m trying to add the numbers up. I know I’m missing something because this code is adding each value twice instead of the whole array of numbers… what am I missing?

It should add up to 100.



var buildArr:Array = [10, 20, 30, 40];
	
	for (i=0; i<=buildArr.length-1; i++) {
		var total:Number = buildArr* + buildArr*
		trace('total: '+total);
	}

This works here:



numberArr = new Array(10, 20);
total = numberArr[0]+numberArr[1];
trace(total);


However, the number array is based on a user’s input, so that’s why I’m putting it inside of a loop.

Any ideas?