Created
November 26, 2017 20:00
-
-
Save selfup/45b9b49154720df51f72769753fdd4cb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Demo() { | |
this.x = 42; | |
} | |
Demo.prototype = { | |
logX: function() { | |
console.log(this.x); | |
}, | |
}; | |
var demo = new Demo(); | |
demo.logX(); | |
////////////////////////// | |
class Demo2 { | |
constructor() { | |
this.x = 42; | |
} | |
logX() { | |
console.log(this.x); | |
} | |
} | |
const demo2 = new Demo2(); | |
demo2.logX(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment