Edit in JSFiddle

function methods(name) {
  function getName(self) {
    return name;
  }

  function setName(self, newName) {
    name = newName;
  }

  return function (methodName) {
    switch (methodName) {
    case 'name':
      return getName;
    case 'name=':
      return setName;
    }
  };
}

//initialize new object with 'Dave' as `name` argument
var dave = objMaker(methods, ['Dave']);

log(dave('name')()); //=> 'Dave'
dave('name=')('David');
log(dave('name')()); //=> 'David'

              
            
          
            
              
                

              
            
          
            
              

External resources loaded into this fiddle: