It's a pretty simple that function that hashes a password.async function createPassword(password) { try { const hashedPassword = await bcrypt.hash(password, 11).then(data => data); console.log('Logged: ', hashedPassword); return hashedPassword; } catch (err) { console.log(err); } } console.log('Returned: ', createPassword('hello')); I am so confused as to why logging 'hashPassword' works but returning it doesn't. On top of that, why does the console.log execute last? Any help would be greatly appreciated.
Submitted July 28, 2020 at 01:28AM by Sweeterman3
No comments:
Post a Comment