Loops With Arrays

 let fruits=["oranges","mangoes","banana","grapes","apples"];

for(let i=0;i<fruits.length;i++){
    console.log(i,fruits[i]);
}

// BACKWARDS
for(let j=fruits.length;j>=0;j--){
    console.log(j,fruits[j]);
}

Comments

Popular posts from this blog

Callback Hell

TODO list with DOM

Refactoring callback hell code