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

#131089
kgscott284
Participant

I am going to expand on this so using an array will make it easier for me to work with when i get that far…

Here is my thought on using the splice idea, I think this one works just fine actually for my purpose:

var arr = [1,3,5,7,9,11,13,15,17,19,21,23,25];

for(var i = 0; i < arr.length; i++) {
arr.splice(i+1,2);
}

console.log(arr);