Array-for-loop

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

/*
    We can save array length in a variable,
    so it is reusable if we need to use it in 
    some other places. 
    
    Also if we save it to variable js will only
    compute it once, it will not compute it every
    time it runs through the loop
*/

let len = arr.length;

/*
    We start our for loop
    For loop has following structure
    
    for (initialization; condition; final expression) { 
        code to be executed 
    }
*/

for (let i = 0; i < len; i++) {
    /*
        This code says: 
        Declare iterator limiter i
        For as long as i is less than array length
        Each round increase i by one
        
        So once i is equal to array length loop
        can stop executing
    */
    console.log(arr[i]);
    //This actually says print element of the array with index i
    
    /*
        Output: 
        1
        2
        test
        bob
        false
        33
    */
    
}