Dapatkan elemen aneh dari daftar javascript
list = [1, 2, 3, 4, 5, 6, 7]
for (var i = 0; i < table.length; i++) {
if(i % 2 === 0 ) { // index is even
odd_elements.push(list[i]);
}
}
console.log(odd_elements)j
>> [2, 4, 6]
Armandres