Here I have the console.log
grouping the true
as a value of 6. How would I get this to loop and log true
each time individually?
var bools = [ true, true, false, true, false, true, true, true ];
for (let i = 0; i <= bools.length; i++) {
if (bools[i] === true) {
console.log(bools[i]);
}
}
I tried to change the if
statement but it did not work.