title: Firebase set new unique ID
body: <p>I'm new to firebase and practicing creating a ToDo application. So far this is my code:</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>var getUserRef = firebase.database().ref('users');
  
  getUserRef.on('child_added', function(data) {
      var name = data.child("name").val();
      var email = data.child("email").val();
      $('#loadData').append(`&lt;tr&gt;&lt;td&gt;${name}&lt;/td&gt;&lt;td&gt;${email}&lt;/td&gt;&lt;td&gt;Edit Remove&lt;/td&gt;&lt;/tr&gt;`);
  });
  
  function addUser() {
      var database = firebase.database();
      var name = $('#name').val();
      var email = $('#email').val();
      var newID = 4; // How can this be incremented?
      database.ref('users/' + newID).set({
          name: name,
          email: email
      });
  }
  </code></pre>
  
  <p><strong>Data Structure:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/1LgEo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1LgEo.png" alt="enter image description here"></a></p>
  
  <p>As you can see, everytime I create a new user, I am manually changing the <code>newID</code> variable. </p>
  
  <p>My problem is I don't want to change it everytime I insert a new user. I want it to aumotically increment or generate a random unique ID.</p>
  
  <p>Is there a way to do this in google firebase?</p>