using for-of loop for getting index value of iteration

PHOTO EMBED

Sun Apr 16 2023 22:18:18 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #javascript #forof #loop #index

const myArray = ['rock', 'paper', 'scissors'];

for(item of myArray){
        const index = myArray.indexOf(item);
        console.log(index)
    
}
content_copyCOPY