您可能正在寻找
confirm(),显示提示并根据用户的决定返回
true或
false:
if (confirm('Are you sure you want to save this thing into the database?')) { // Save it! console.log('Thing was saved to the database.');} else { // Do nothing! console.log('Thing was not saved to the database.');}


