Check out my JavaScript code snippet below:
let links = ["id1", "id2", "id3"];
let container = document.getElementById('container');
links.forEach(function(link){
container.innerHTML += "<a href=\""+link+"\">"+link+"</a>"
});
Is there a way to bind an onClick Event handler to each link using an array, instead of repeating the code for each link?