Array-while-loop

let arr = [1, 2, "test", "bob", false, 33];
let i = 0;

/*
    While loop does not require as much
    parameters as for loop, but we have to 
    declare iterator i so we can break out
    of the loop
    
    While loop has following structure
    
    while(condition) {
        code to run
    }
*/

while (arr[i]) {
    /*
        This code means
        While there is element in array arr
        under the number i continue loop
        and increment i.
        
        So when there is no more indexes, loop
        will stop running
        
        Also you will notice that even though
        there is false on index 4 it will 
        skip it, since it is false
    */
    console.log(arr[i]);
    
    /*
        Output: 
        1
        2
        test
        bob
        33
    */
    i++;
}