在下面的代码中 question1 的值是NaN
. 我想将其转换为 0,但我无法使用parseInt
. 我怎样才能做到这一点?
app.post('/auth/total',function(req,res){
console.log(req.body);
const { question1, question2, question3, question4} = req.body;
let total1 = parseInt(question1) + parseInt(question2)
let total2 = parseInt(question3) + parseInt(question4)
//some code to insert data in db and render the view
});