title: Linking variables
body: <p>This a simple summary of my code:</p>
  
  <pre><code>var list = {
      "group":{
          "subgroup1":[{"name1":"Jimmy","name2":"Bob"}],
          "subgroup2":[{"name1":"Sarah","name2":"Nick"},{"name1":"Kevin","name2":"George"}]
      }
  }
  function group(group,name){
      var linktothegroup;
  
      //Note: In my actual code it will attempt to join a group before creating one this just creates a new one
  
  
      //group: Specifies which subgroup to join (my actual code will check if it's valid this is just a simpler version
      //name: the users name
  
      list["group"][group].push({"name1":name,"name2":""});
      linktothegroup = someway to link that group I just added; //I figured I could find the array slot and specify but that will change if a group is deleted
  
      this.leavegroup = function(){
          //leaves the group
          //uses the linktothegroup var to be removed from the group
      }
      this.changename = function(name){
          linktothegroup.name1 = name;
          return true;
      }
  }
  var cubscouts = new group("subgroup1","Billy");
  cubscouts.changename("Fred");
  </code></pre>
  
  <p>I just wanna be able to edit values in the "subgroupX" fields (Basically for the changename function), but there are groups leaving and joining all the time so I can't specify the array slot in a variable. </p>
  
  <p>So basically is there a way to edit one variable and have another variable change with it?</p>