![]() |
Returning Index
Hi all,
I have a bit of a problem with a project and was hoping that somebody could help me out. Here goes! I have a set of integers ie (1,-2,0,4,-5,0,7,-8,0,10) what I need to do is loop through and then return only the positive integers leaving out the negatives. This is easy enough but I have to return the index positions of the positive integers ie, (1,3,4,6,7,9,10). However I'm having major trouble with the logic because I need the integers in reverse order. What I get is the index integers from 1-7 not waht I need. Can anybody help me out with this one. Many thanks in advance. |
Re: Returning Index
Just loop the array of integers in reverse.
:
var integerArray = [1,-2,0,4,-5,0,7,-8,0,10]; |
Re: Returning Index
Many thanks,
I was getting bogged down by the logic. |
| All times are GMT -5. The time now is 9:10 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC