title: push name and amount to javascript object
body: <p>I am trying to create an app for a site and users can send money to people on this site. Kinda like twitch. So i wanna create a toplist but i am new to using objects so i'm having some trouble and to explain my problem in a more easy way i added comments in my code</p>
  <pre><code>var myvar = [];
  
  cb.onTip(function(tip){
    // If username already exists in myvar then i want to just increase the amount for this user else if username does not exist i want to push up the name and amount to myvar
    myvar.push({name: tip.from_user, amount: tip.amount});
  }); 
  
  function sendtoplist(user) {
    var msg;
    for(var i = 0; i &lt;= 3; i++) {
      // Here i am trying to create a toplist but i want to sort it by the amount. How can i do this?
      msg += myvar.name + ' ' + myvar.amount+'\n';
    }
  
    // For some reason this sendNotice returns undefined (probably because i have no idea how to work with objects)
    cb.sendNotice(msg, '', '#000000', '#FFFFFF', 'bold');
    cb.setTimeout(sendtoplist, 30000);
  }
  cb.setTimeout(sendtoplist, 30000);
  </code></pre>