function getSetter(obj, prop) {
return function (value) {
obj[prop] = value;
};
}
var example = { text: 'Hello'};
var setExampleText = getSetter(example, 'text');
console.log(example ); // {text: "Hello"}
setExampleText('Hello World');
console.log(example ); //{text: "Hello World"}