我一直在try 使用一个函数来更改DOM的背景色.我可能在"脸上"遗漏了什么,但我看不到
我的JS代码是-
function changeBg() {
let newBgColor = document.querySelector("body")
console.log(newBgColor)
newBgColor.style.backgroundColor = "white";
}
The CSS Im hoping to change is -
body {
font-family: 'Open Sans';
font-weight: normal;
max-width: 760px;
background-color: #ffe8d6;
margin: 0 auto;
color: rgb(193, 178, 164);
}
``
I keep getting this error -
ReferenceError - newBgColor is not defined.