title: comparing two same string hashing in bcrypt returns undefined
body: <p>I'm trying to hashing two same string and compare them to validate whether the password is correct or not. I've used <code>bcrypt</code> package in nodeJS.
  When I use <code>bcrypt.compare</code> method, it returns undefined!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var akbar, akbar2;
    bcrypt.hash('salam', saltRounds, (err, hash) =&gt; {
      akbar = hash;
      console.log(akbar);
    });
  
    bcrypt.hash('salam', saltRounds, (err, hash) =&gt; {
      akbar = hash;
    });
  
    bcrypt.compare(akbar, akbar2, (err, res) =&gt; {
      console.log(akbar, akbar2, res);
    });
  </code></pre>
  
  <p>here is the console result:</p>
  
  <blockquote>
    <p>undefined undefined undefined
    $2b$10$6dxYYYc2Ud3dVVeWU9GcOe6v9l8FT7GR5gNC6Pt0Xc1N.Si1R.EIC</p>
  </blockquote>