I need to loop through thus array:
const arr = [1,2,3]
...and to store the data from the array in this way:
const test = = dataIndex.forEach((i, n) => {return(i)})
When i will use test, i want to have next data in it:
1
2
3
Now my code looks like that:
const arr = [1,2,3]
const test = arr.forEach(i => i)
console.log(test) //i get undefined
In this code i get undefined. How to achive what i want?