Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript grab only even array index

for (var i = 0; i < a.length; i++) {
    if(i % 2 === 0) { // index is even
        ar.push(a[i]);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #grab #array #index
ADD COMMENT
Topic
Name
3+7 =