为什么常量声明的分号前的[0]起作用?
const myHeading = document.getElementsByTagName("h1")[0];
const myButton = document.getElementById("myButton");
const myTextInput = document.getElementById("myTextInput");
const myP = document.getElementById("myP");
myButton.addEventListener("click", () => {
myHeading.style.color = myTextInput.value;
});
翻过高山走不出你
郎朗坤
Cats萌萌
相关分类