Created
May 23, 2016 21:09
-
-
Save duduindo/0d5cb02ad1f50582d5450b26a6a6cd6e 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
/** | |
* Multiples extends Javascript ES6 | |
* @About: Clone method's class | |
**/ | |
class SuperExtends { | |
constructor(ar) { | |
ar.forEach((item) => { | |
const news = new item; | |
const arNews = Object.getOwnPropertyNames(news.constructor.prototype); | |
arNews.shift(); | |
arNews.forEach((val) => { | |
this.constructor.prototype[val] = news.constructor.prototype[val]; | |
}); | |
}); | |
} | |
} | |
/** | |
* Using/Example | |
**/ | |
class Head { | |
snout() {} | |
mouth() {} | |
} | |
class Body { | |
core() {} | |
stomach() {} | |
} | |
class Dog extends SuperExtends { | |
constructor() { | |
super([Head, Body]); | |
console.dir(this); //Console in browser: Dog > __proto__ | |
} | |
} | |
new Dog(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment