Skip to content

Instantly share code, notes, and snippets.

@rolaveric
Created October 31, 2014 07:55
Show Gist options
  • Save rolaveric/241332ae69db2628c24d to your computer and use it in GitHub Desktop.
Save rolaveric/241332ae69db2628c24d to your computer and use it in GitHub Desktop.
ES6 Class and equivalent ES5 code
// ES6 Class
class MyClass {
constructor() {
this.a = "b";
}
getA() {
return this.a;
}
}
// ES5 Equivalent
function MyClass() {
this.a = "b";
}
MyClass.prototype.getA = function() {
return this.a;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment