почему this в javascript при click выбирает window?

код выглядит так:

<html>

<head>
</head>

<body>
  <h2>constructors: repeat the lesson!</h2>
  <button onclick="changep1()">Click Me</button>
  <button onclick="changep2()">Click Me</button>
  <script>
    function BankBill(name, surname, region, passNo) {
      this.clientName = name;
      this.clientSurname = surname;
      this.clientRegion = region;
      this.clientPassportIDNumber = passNo;
      this.desc = function() {
        return this.clientName + ' ' + this.clientSurname + ' from ' + this.clientRegion + ' with his / her ID No ' + this.clientPassportIDNumber + ' opened bill on our bank';
      }
    }

    var b1 = new BankBill('Isaac', 'Newton', 'Khorezm', 'KA5458565');
    var b2 = new BankBill('Ivan', 'Petrov', 'Tashkent', 'TA5458565');

    function changep1() {
      console.log(this);
      this.innerHTML = b1.desc();
    }

    function changep2() {
      this.innerHTML = b2.desc();
      console.log(this);
    }
  </script>

</body>

</html>


Ответы (0 шт):