How NOT to overwrite my javascript object values

I have a javascript object.  I get values for the properties by iterating a table on my html page.  Problem is every time the loop iterates it overwrites the previous value.  

Please see attached a file.

How can I add to my object without overwriting previous values?
overrite-object.txt
vstackAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John Gates, CISSPSecurity ProfessionalCommented:
You need to read the values into an array:
http://www.w3schools.com/js/js_arrays.asp
hieloCommented:
<script type="text/javascript">
var result=[];
for (var i = 1; i in foreignTable.rows; i++) {
            var theopenrow = foreignTable.rows[i];
            //getting foreign currency acronym
            var thetagcurrency = theopenrow.getElementsByTagName('span')[0];
            var foreigncurrencyacronym = thetagcurrency.textContent;

            //getting foreign currency ID from hiddenfield
            var inputmyid = theopenrow.getElementsByTagName('input')[1];
            var myforeignid = inputmyid.value;
            //combines acronym with id

            //getting foreign cash count
            var inputmyclose = theopenrow.getElementsByTagName('input')[0];
            var myopen = parseFloat(inputmyclose.value);
		//here I want to assign the ID
		foreigncurrency.ID = myforeignid;	
		//here I want to assign the acronym like USD
		foreigncurrency.Acronym = foreigncurrencyacronym;
		//here I want to assign the cash amount, myopen
		foreigncurrency.Total = myopen;
			result.push(myforeignid+':'+foreigncurrencyacronym+':'+myopen);

            }
//result is an array that contains items, each of which has the format: "1:USD:500" 

// temp is a string representation of the array values, they have all been "glued" together by a newline
var temp = result.join("\n")
alert( temp )
</script>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vstackAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.