Guest User

Untitled

a guest
May 20th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // () → String
  2. // Returns the full name of object.
  3. function get_full_name() {
  4.     return this.first_name + ' ' + this.last_name
  5. }
  6.  
  7. // (new_name:String) → undefined
  8. // Sets the name components of the object, from a full name.
  9. function set_full_name(new_name) { var names
  10.     names = new_name.trim().split(/\s+/)
  11.     this.first_name = names[3] || ''
  12.     this.last_name  = names[4] || ''
  13. }
  14.  
  15. Object.defineProperty(mikhail, 'name', { get: get_full_name
  16.                                        , set: set_full_name
  17.                                        , configurable: true
  18.                                        , enumerable:   true })
Add Comment
Please, Sign In to add comment