title: JavaScript: function returning an object
body: <p>I'm taking some JavaScript/jQuery lessons at codecademy.com. Normally the lessons provide answers or hints, but for this one it doesn't give any help and I'm a little confused by the instructions. </p>
  
  <p>It says to make the function makeGamePlayer return an object with three keys. </p>
  
  <pre><code>//First, the object creator
  function makeGamePlayer(name,totalScore,gamesPlayed) {
      //should return an object with three keys:
      // name
      // totalScore
      // gamesPlayed
  }
  </code></pre>
  
  <p>I'm not sure if i should be doing this</p>
  
  <pre><code>//First, the object creator
  function makeGamePlayer(name,totalScore,gamesPlayed) {
      //should return an object with three keys:
      // name
      // totalScore
      // gamesPlayed
  
           this.name =  name;
           this.totalScore = totalScore;
           this.gamesPlayed = gamesPlayed;
  }
  </code></pre>
  
  <p>or something like this</p>
  
  <pre><code> //First, the object creator
      function makeGamePlayer(name,totalScore,gamesPlayed) {
          //should return an object with three keys:
          // name
          // totalScore
          // gamesPlayed
  
           var obj = {
               this.name =  name;
               this.totalScore = totalScore;
               this.gamesPlayed = gamesPlayed;
            }
      }
  </code></pre>
  
  <p>I have to be able to modify the properties of the object after its created. </p>