document.querySelector("#myBtn").onclick = function () {
console.log("Clicked");
const h1 = document.querySelector("#myH1");
const underline = document.createElement("u");
underline.innerText = "Hey bro.";
h1.innerText = "";
h1.append(underline);
const p = document.querySelector(".myP");
p.forEach((element) => (element.innerText = "Thank You!!!!"));
const btn = document.querySelector("button");
btn.remove();
};
p.forEach((element) => (element.innerText = "Thank You!"));
I got: Error TypeError p.forEach is not a function
EDIT: Thanks For Answer this question I really appriciated