you can use these loops are references if you need to irriritate a javascript object.

// LOOP SHAREPOINT API OBJECT
for (let [property, value] of Object.entries(objName)){
 
}

// LOOP ARRAY  
for (let index = 0; index < array.length; index++) {
  const element = array[index];
  loop
}

// OF
let colors = ["red", "blue","green"];
for(let color of colors){
    console.log(color); // "red", "blue","green"
}
// IN
let colors = ["red", "blue","green"];
for(let index in colors){
    console.log(colors[index]); //"red", "blue","green"
}
// IN
nameObj = {"first":"John","last":"smith"}
for (var key in nameObj) { var value = nameObj[key];
    alert('key='+key+' | value='+value);
}