0

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

<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>

Dmitry
  • 7,859

0 Answers0