Hi!
I don’t understand why is this piece of code logging me: “target is not defined”
const target = "I am target";
const keydownHandler = function() {
let target = target;
console.log(target)
};
window.addEventListener('keydown', keydownHandler)
Especially that , if I don’t declare target variable in the keydownHandler scope, it does give me its value.
const target = "I am target";
const keydownHandler = function() {
console.log(target)
};
window.addEventListener('keydown', keydownHandler)
Thank you for clarification.