Because closure and scope isn't the same in javascript either. A closure can have access to three scopes. It's own scope, an outer functions scope, and global variables.
You can also take a function as an argument (or from a reference in an outer scope), and apply it inside the current function’s scope, which is how classes are “extended.”
Is a global not just an outer function scope? Like the window object in a browser is just the most outer one so all child functions have access to its properties.
5
u/Candyvanmanstan May 28 '19
Because closure and scope isn't the same in javascript either. A closure can have access to three scopes. It's own scope, an outer functions scope, and global variables.