var btn = document.createElement("BUTTON"); // Create a <button> element
btn.innerHTML = "CLICK ME"; // Insert text
document.body.appendChild(btn); // Append <button> to <body>
// A function to create elements in JS
function elementFactory(tag, text) {
const el = document.createElement(tag);
el.textContent = text;
return el;
}
const someListItem = elementFactory("li", "some text");