Hi i wonder if anyone can help, I'm trying to write a program in JS to add the elements of two arrays together - ie firstArray = [1,2,3,4,5,6,7,8,9] secondArray = [2,3,4,5,6,7,8,9,10]...........I need to know how to add the first element in firstArray to the first element in secondArray and display the result.
I have the data in the arrays already and have writen this:-
but I do not know how to add the elements together, I thought of putting:- totalVotesArray = ((onlineVotesArray) + (paperVotesArray)); but that does not work - help please!
The question has been closed Jun 02 '11 at 02:00 PM by Eric5h5 for the following reason:
Before your for-loop initialize the array to have the correct size:
In your for-loop just add the arrays on a per-element-basis:
answered Jun 02 '11 at 10:51 AM