const ary = [1, 5, 3]
ary.forEach(mult)
function mult(items, index, arr) {
arr[items] = index * 2;
}
console.log(ary)
[1, 5, 3]
In the start items=1 index=0
arr[1]= 0*2 i,e 0
[1,0,3]
then items becomes 0 index=1
arr[0]= 1*2 i,e 2
[2,0,3]
then items becomes 3 index=2
arr[3]= 2*2 i,e 4
arr[2] remains same
items gets changed when arr[items] gets modified