Created
October 25, 2016 22:44
-
-
Save rsolomo/c134d4bf5b08fd7ad58d1300934a84f7 to your computer and use it in GitHub Desktop.
new class vs new function prototype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Foo1() { | |
} | |
Foo1.prototype.interact = function() { | |
this.dispose = true | |
} | |
class Foo2 { | |
interact() { | |
this.dispose = true | |
} | |
} | |
console.log('Foo1') | |
console.log(Object.getOwnPropertyDescriptor(Foo1, 'prototype')) | |
console.log(Object.getOwnPropertyDescriptor(Foo1.prototype, 'interact')) | |
console.log() | |
console.log('Foo2') | |
console.log(Object.getOwnPropertyDescriptor(Foo2, 'prototype')) | |
console.log(Object.getOwnPropertyDescriptor(Foo2.prototype, 'interact')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment