I have this script
var b = {
c: {
a: document.querySelector(".a"),
init: function() {
this.a.style.backgroundColor = "red";
this.a.addEventListener("click", b.c.change);
},
change: function() {
this.a.style.width = "100px";
}
}
}
b.c.init();
.a {
width: 10px;
height: 10px;
background: black;
cursor: pointer;
}
<div class="a"></div>
Why this.a style "undefine"???