0

Why hello function return window object? Shouldn't it return App object? hello function is a regular function and it is supposed to return the object that calls it.

<body>
  <button id="btn">Click Me!</button>

  <p id="demo"></p>
  <script>
    function hello() {
  return this
  }
  class App {
    constructor() {
      
    };
    a() {
      return hello()
    }
  }
  console.log(new App().a())
  </script>
</body>

0 Answers0