How to compare a parameter given in 1 function with the parameter of another function in Javascript
<p>this is what I am trying to solve out</p>

<pre><code>    var name;
    var totalScore;
    var gamesPlayed;
    var player;
    var score;

    //First, the object creator
    function makeGamePlayer(name,totalScore,gamesPlayed) {
        //should return an object with three keys:
        // name
        // totalScore
        // gamesPlayed
        o = {
            'name' : name,
            'totalScore' : totalScore,
            'gamesPlayed' : gamesPlayed
        };
        return o;
    }

    //Now the object modifier
    function addGameToPlayer(player,score) {
        //should increment gamesPlayed by one
        //and add score to totalScore
        //of the gamePlayer object passed in as player
        if(player == name) {
            gamesPlayed += 1;
            totalScore += score;    
        }

    }
</code></pre>

<p>but the 2nd function where I have used if now should be something else... how can I compare this 2? ( its from an exercise to learn JS )</p>
