I am trying to set the variable passHash (that is outside of bcrypt's hash function) to bcrypt-generated hash parameter but passHash is still returning an empty string. But, when I print hash on its own, it correctly prints a hash. Does anyone know of a solution to this? Thanks!
Code:
let passHash = '';
bcrypt.hash(code, 10, function (err, hash) {
passHash = hash;
});
//Output: passHash = '';