I am currently facing difficulties in creating buttons for values within an array, which are also nested inside another array. As an example:
let numbers = [{"allNum": ["0", "1", "2", "3","4"]}, {"evenNumbers": ["2", "4"]}];
If I want to create buttons for all the values within allNum, do I need to use a combination of forEach() and createElement? And should it be implemented like this?
// Suppose there is an html element with id "li"
var liEl= document.querySelector ("li");
function createBtn (allnum) = { document.createElement("button")
liEl.appendChild (createBtn);
return createBtn;
};
numbers.forEach (createBtn)
Thank you for taking the time to assist!