title: How to change property values of object passed into a function?
body: <p>I am trying to change the property values of an object I pass into my function. If object has the property (for example 'stuff' it should change its value from some to'new value' - however my code doesn't work-could someone explain why its not working and how I can change the values?
  Thank you!!</p>
  
  <pre><code>function changeProperties(obj) {
      //  var obj;
      return function() {
              //var properties=
              for (var key in obj) {
                  if (arguments.length == 1) {
                      if (key == arguments[0]) {
                          return obj[key];
                      } else {
  
                          obj[key] = arguments[1];
                          return obj[key];
                      }
                  }
              }
          }
      //return obj;
  }
  
  var obj = {
      stuff: 'some'
  };
  var changing = changeProperties(obj);
  
  changing('stuff', 'new value');
  obj.stuff;
  </code></pre>