How can I dynamically create HTML buttons, in Javascript, that when users click on them they call a same function, but with a different parameters. For example:
function a(param){console.log(param);};
for (int i = 0; i < 10; i++)
{
button = document.createElement('button');
button.onclick = <place a function that when button is clicked, calls function a with parameter i>;
}
Can someone give me a clue?