In the below code snippet,
function retreive_data_from_UI() {
    let arr_rows = [];
    cy.get(constants.cssCustomerWoListViewTable).children().each(($rows, ind) => {
        arr_rows.push($rows.text());
        cy.log(ind);
        cy.log(arr_rows[ind]);
    });
    cy.wait(1000);
    for(var i = 0; i < 5; i++){
        // I tried both separately pop() and accessing by index
        cy.log(arr_rows.pop());
        // or
        cy.log(arr_rows[i]); 
    }
    return arr_rows;
}
the value for arr_rows[ind] is printed within cy.get().children().each(() => {}) block but not in the for loop that follows it. Below is the output
Can anyone point out where I went wrong ? I am using cypress for writing frontend tests.
 
     
    