Hi please help I am trying to get toFixed(2) don't know where I am going wrong
function addFunction(item) {
let cost = 0
if (totalSettings < criticalLevel) {
switch (item) {
case "call":
cost = callCost.toFixed(2);
totalSettings += callCost;
callTotalSettings += callCost;
break;
case "sms":
cost = smsCost.toFixed(2);
totalSettings += smsCost;
smsTotalSettings += smsCost;
break;
}
userMappedData.push({
type: item,
cost,
timestamp: new Date()
})
return true
}
}
function settingsBillTotals() {
return {
totalSettings.toFixed(2),
callTotalSettings.toFixed(2),
smsTotalSettings.toFixed(2)
};
}
please note settingsBillTotals() currently doesnt work thats where i thought i should put toFixed() i tried putting it on total settings but still wont work, my heroku app link https://settingsbillexpress.herokuapp.com/ if not sure what i mean
let totalset = totalSettings.toFixed(2);
let callTotalset = callTotalSettings.toFixed(2);
let smsTotalset = smsTotalSettings.toFixed(2);
return {
totalset,
callTotalset,
smsTotalset
};
}```
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.