Message from JavaScript discussions
May 2018
— For a number of reasons
1. It forces me to split up my code into smaller parts
2. Errors are normally easier to handle with promises than in async / await (.catch()
over try
/ catch
)
— Got my answer 😎
— Was just curious why people still use promises and u just answered it
—
var a = 5;
function lol() {
var a = 10;
console.log(this.a)
function kek() {
console.log(this.a)
}
kek()
}
—
lol()
outputs
5
5
— Can somebody explain me why?
First console log prints 5 that makes sense as call site for lol function is global scope but for kek function call site is lol() then why its logging 5 instead of 10?
— Why you put this
?
— SetProperty is used for css variables not for css properties, you seem confused about the two
— It can set both
— Just trying to figure out how
this
works
— Btw I got my answer 😄