its a simple Problem but I can't find a good solution.
I have a list of buttons in Javascript and I want to return them their specific Id.
for (var i = 0; i < ButtonsArray.length ; i++){
ButtonsArray[i].onclick= function(){console.log(i);};}
Simple when I click on a Button, he will then take I which is now the ButtonArraylength.
for example :
length = 10 , ButtonArray[2] -> 10 , ButtonArray[7] -> 10
What is the simplest solution to make every Button return that value of I when the onclick was created (ButtonsArray[5] -> 5 , 6 -> 6 ,etc.)