Message from JavaScript discussions

May 2018





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



— Btw I got my answer 😄

— Global scope?

— This (in the absence of new, bind, call or apply magic) refers to the object in which the function was called.

If there is no object, then the default object is used. For web browsers, that object is window.

Message permanent page

— Is it in spec?

— So yes global

— It's in mozilla docs