这是我的代码
const bcrypt = require('bcryptjs');
const salt = bcrypt.genSalt(11);
const user = {
first: "Donald",
last: "Trump",
password : bcrypt.hash(this.password, salt),
greetUser(password) {
console.log(`Hi, ${this.first} ${this.last} ${this.password}`);
},
};
let password = 'secondhand01';
user.greetUser(password);
我跑
node --trace-warnings index.js
Hi, Donald Trump [object Promise]
(node:15222) UnhandledPromiseRejectionWarning: Error: Illegal arguments: undefined, object
我期望的是散列密码。为什么终端指向非法参数?
蓝山帝景
相关分类