I am trying to find out why createElement or maybe appendChild doesn't work Does every createElement have some kind of unique id?
Works - 4 buttons
const arr = [1, 2, 3, 4];
const list = document.getElementById('list');
arr.map(item => {
const newButton = document.createElement('button');
newButton.innerHTML = `Button`;
list.append(newButton)
});
Doesn't work - only 1 button it seems it would work to me...
const list2 = document.getElementById('list2');
const newButton2 = document.createElement('button');
newButton2.innerHTML = `Button2`;
arr.map(item => {
list2.append(newButton2);
});