Instantly share code, notes, and snippets.

@whtswrng /lsp.jsx
Last active Oct 23, 2018

What would you like to do?
class User {
constructor(roles) {
this.roles = roles;
getRoles() {
return this.roles;
class AdminUser extends User {}
const ordinaryUser = new User(['moderator']);
const adminUser = new AdminUser({role: 'moderator'},{role: 'admin'});
function showUserRoles(user) {
const roles = user.getRoles();
roles.forEach((role) => console.log(role));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment