I'm trying to iterate through the array of numbers and print all its elements
var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
function q(arr) {
for(var i=0; i<arr.length; i++) {
if(arr[i]) {
console.log(arr[i]);
}
}
}
q(arr);
The array contains 11 elements, but my code prints only 10 (except the 1'st element). But why? And how can i print my array completely?
Thank you