this
has nothing to do with scope. It is determined by context.
greeting()
calls the function with no context, so this
is the default object (window
in a browser).
More Related Contents:
- How does the “this” keyword work?
- Use of ‘prototype’ vs. ‘this’ in JavaScript?
- Javascript: Do I need to put this.var for every variable in an object?
- What does “this” refer to in arrow functions in ES6?
- What does ‘var that = this;’ mean in JavaScript?
- React: “this” is undefined inside a component function
- Javascript call() & apply() vs bind()?
- Why is JavaScript bind() necessary?
- Javascript “this” pointer within nested function
- “this” is undefined inside map function Reactjs
- Arrow Functions and This [duplicate]
- VueJS: why is “this” undefined?
- this inside function
- JavaScript – Owner of “this”
- The invocation context (this) of the forEach function call
- Does using $this instead of $(this) provide a performance enhancement?
- this operator in javascript
- “This” within es6 class method [duplicate]
- requestAnimationFrame with this keyword
- Javascript lost context when assigned to other variable
- jQuery/JavaScript “this” pointer confusion
- What is the ‘global’ object in NodeJS
- Preserve ‘this’ reference in javascript prototype event handler [duplicate]
- Save access to this scope
- Why does String.prototype log it’s object like a standard object, while Array.prototype logs it’s object like a standard array?
- What does “this” mean in a nodejs module?
- onClick Function “this” Returns Window Object
- JS call static method from class
- Javascript scope addEventListener and this
- How does event handlers with arrow functions achieve context binding