let chars = ['A', 'B', 'A', 'C', 'B']; chars.forEach((element, index) => { console.log(`${element} - ${index} - ${chars.indexOf(element)}`); });