Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // () → String
- // Returns the full name of object.
- function get_full_name() {
- return this.first_name + ' ' + this.last_name
- }
- // (new_name:String) → undefined
- // Sets the name components of the object, from a full name.
- function set_full_name(new_name) { var names
- names = new_name.trim().split(/\s+/)
- this.first_name = names[3] || ''
- this.last_name = names[4] || ''
- }
- Object.defineProperty(mikhail, 'name', { get: get_full_name
- , set: set_full_name
- , configurable: true
- , enumerable: true })
Add Comment
Please, Sign In to add comment