Javascript forEach with IndexOle Ersoy·Follow1 min read·Mar 18, 2020--ListenShareImage by Gerd Altmann from PixabayScenarioWe need access to the index of each value in the array [1,2] .Approach[1,2].forEach((value, i)=> { console.log('%d: %s', i, value);})Result0: 11: 2Demo