I was hoping that this code
let name = 'Sally'
setTimeout(() => console.log(name), 3000)
name = 'Pepe';
Would output Sally (because of the timeout handler declaration "capturing" the name), but it doesn't happen in the Console. Why is that? I know it is related to closures but it seems I didn't fully understand it, as this very same problem happens a lot to me in React but I wanted to simplify and couldn't.