Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Returning every third odd number within a user specified range Re: Returning every third odd number within a user specified range

#131086
kgscott284
Participant

Consecutive, Starting at 1….What i am going to do since it is for my personal use is make an html form with 2 text boxes for the range…the closest thing i have of the basic functionality is this, i just am not sure where to go from there…and i don;t think it is looping correctly i still have to check on that….like i said, i know crap about javascript…i can do every other with this method, not every third though…

perhaps using splice or push would be a better option?

var arr = [1,3,5,7,9,11,13,15,17,19,21,23,25];
for(var i = 1; i < arr.length; i+=2){
console.log(i);
}