I'm having trouble adjusting the inner HTML of specific "div" elements using JavaScript. When I try to change the HTML of a single element in an array, it ends up changing all elements instead.
let div_length = 2;
const divs = new Array(div_length).fill(document.createElement("div"));
divs[0].innerHTML = "Hello";
console.log(divs[0].innerHTML); // Hello
console.log(divs[1].innerHTML); // Hello
Is there a way to modify this code so that it only updates the HTML of the first element?