Skip to content

Instantly share code, notes, and snippets.

@rxluz
Last active January 18, 2019 02:34
Show Gist options
  • Save rxluz/ac12b11da6d330015d9d2a28f7727a9b to your computer and use it in GitHub Desktop.
Save rxluz/ac12b11da6d330015d9d2a28f7727a9b to your computer and use it in GitHub Desktop.
S.O.L.I.D Principles for JS with examples, see more at https://medium.com/p/db95b44e82e
class User {
constructor(name, age) {
this.name = name;
this.age = age;
this.logs = [];
}
setName(name) {
this.name = name;
this.logs.push("Edited user name");
}
setAge(age) {
this.age = age;
this.logs.push("Edited user age");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment