Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. "use strict";
  2.  
  3. var _prototypeProperties = function (child, staticProps, instanceProps) {
  4. if (staticProps) Object.defineProperties(child, staticProps);
  5. if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
  6. };
  7.  
  8. var Person = (function () {
  9. function Person(firstName, lastName) {
  10. this.firstName = firstName;
  11. this.lastName = lastName;
  12. }
  13.  
  14. _prototypeProperties(Person, null, {
  15. name: {
  16. get: function () {
  17. return this.firstName + " " + this.lastName;
  18. },
  19. set: function (name) {
  20. var names = name.split(" ");
  21.  
  22. this.firstName = names[0];
  23. this.lastName = names[1];
  24. },
  25. configurable: true
  26. }
  27. });
  28.  
  29. return Person;
  30. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement