Advertisement
ralitsa_d

Untitled

Oct 24th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function solve() {
  2. let obj = {};
  3.  
  4. let myObj = Object.create(obj);
  5.  
  6. myObj.extend = function (template) {
  7. for (let prop in template) {
  8. if (!myObj.hasOwnProperty(prop)) {
  9. if (typeof template[prop] == 'function') {
  10. Object.getPrototypeOf(myObj)[prop] = template[prop];
  11. }
  12. else {
  13. myObj[prop] = template[prop];
  14. }
  15. }
  16. }
  17. };
  18.  
  19. return myObj;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement