title: Parse Cloud set and get functions
body: <p>I'm trying to implement a simple getter and setter functions for a String value using Parse Cloud but for some reason it doesn't work. I searched the Parse documentation and forums but couldn't find the reason. Please advise me.</p>
  
  <pre><code>function setPassword(newPass){
      console.log('setPassword() started with input ' +newPass);
      var PasswordItem = Parse.Object.extend("PasswordItem");
      var query = new Parse.Query(PasswordItem);
      if (query.length &gt; 0) {
          if (query[0].password != newPass) {
              console.log('setPassword() found existing password. replacing it with ' +newPass);
              query[0].password = newPass;
          }else{
              console.log('setPassword() found existing password. existing password is the same as the new one');
          }
      }else{
          console.log('setPassword() no existing password. creating new password: ' +newPass);
          var passwordItem = new PasswordItem();
          passwordItem.set("password", newPass);
          passwordItem.save(null, {
              success: function (results) {
                  console.log("Save ok");
                  response.success(results);
              },
              error: function (results, error) {
                  console.log("Save error");
                  response.error(error);
              }});
      }
  }
  
  function getPassword(){
      console.log('getPassword() started');
      var password = new String();
      var PasswordItem = Parse.Object.extend("PasswordItem");
      var query = new Parse.Query(PasswordItem);
      if (query.length &gt; 0) {
          password = query[0].password;
      }else{
          password = "";
      }
      console.log('getPassword() returns ' +password);
      return password;
  }
  </code></pre>
  
  <p>P.S please ignore security issues related to passwords, this is just an example.</p>