title: NodeJS callback with null as first argument
body: <p>I've just started out with NodeJS and trying to get the hang of callbacks. </p>
  
  <p>Today I've seen null passed by as the first argument to the callback in many examples. Please help me understand why it's there and why I need it.</p>
  
  <p><strong>Example 1</strong></p>
  
  <pre><code>UserSchema.methods.comparePassword = function(pwd, callback) {
      bcrypt.compare(pwd, this.password, function(err, isMatch) {
          if (err) return callback(err);
          callback(null, isMatch);
      });
  };
  </code></pre>
  
  <p><strong>Example 2</strong></p>
  
  <pre><code>example.method = {
      foo: function(callback){
          setTimeout(function(){
              callback(null, 'foo');
          }, 100);
      }
  }
  </code></pre>