Link to home
Start Free TrialLog in
Avatar of jagku
jagkuFlag for United States of America

asked on

Traversing arrays in javascript

Hello Experts,

I have the following code:

		var myarr = new Array();
		myarr[10] = 10;
		myarr[5] = 50;
		myarr[17] = 70;

		for(var i in myarr)
		{
			document.write("<BR>"+i);
		}

Open in new window


How can I traverse the array so the results is:

5
10
17

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jagku

ASKER

Ahhh, I tried that - but thought there might be something more jazzier!

As usual, thank you!!!