I have the following Javascript file:
class Coo {
constructor() {
}
}
function foo() {
}
Now if I load this into a browser (with a script
tag), there is now a function window.foo
defined. However, window.Coo
is undefined.
So how does the scope of class
work and how is it different from function
?
In other words: Where do classes live?