I'm kind of new to JS, while reading the document from mozilla.org, I read that when declaring a const
in global, it doesn't become a property of the global object. My question is, if so, where is the property stored?
For example:
const a = 'HI!';
function hello() {
console.log(this.a); // undefined
}
hello();
This logs out undefined.
Instead of assigning it with
global.a = 'HI!'
Are there other ways I can access a
with this
?