Created
March 9, 2016 17:53
-
-
Save lukehedger/be084e0163a146f8ef45 to your computer and use it in GitHub Desktop.
Just playing around with ES6 Classes
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
class Klass { | |
constructor() { | |
console.log('hello class!') | |
} | |
static util(a, b) { | |
return a + b | |
} | |
render() { | |
console.log('render') | |
} | |
} | |
const klass = new Klass() | |
klass.render() | |
// can't call klass.util() as it is a static prop of Klass | |
const utilCall = Klass.util(1, 2) | |
console.log(utilCall) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Resources:
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Classes
https://medium.com/@housecor/in-defense-of-javascript-classes-e50bf2270a95
https://medium.com/javascript-scene/how-to-fix-the-es6-class-keyword-2d42bb3f4caf