1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| function newInstanceof (x, y) { while (x.__proto__ !== null) { if (x.__proto__ === y.prototype) { return true } x.__proto__ = x.__proto__.__proto__ } return false } function Person () { this.name = 'daipi173' } let person = new Person() console.log(newInstanceof(person, Person))
|