JS — arrow function, “this”. and setTimeout
1 min readSep 14, 2018
i’ve stumbled on this
Arrow function can’t get ‘this’ that i wanted
const key = document.querySelector(".key");
key.addEventListener("click", () => {
console.log(this)
});//windowkey.addEventListener("click", funciton (){
console.log(this)
});//<div class="key">this</div>
I can’t get dom element -‘div.key’ but just window.
why?
check it out below. what does mr. wes tell us .