function RegisterAction() {
let saveSub = buyMore(0);
let askbuyMore = prompt("Do you want to buy more? Y/N ");
if(askbuyMore === "Y"||"y"||"Yes"||"yes"){
saveSub = buyMore(saveSub);
askbuyMore = prompt("Do you want to buy more? Y/N ");
}else{
return saveSub;
}
const caSalesTax = .0725;
let caSalesTaxPercent = Math.round((caSalesTax*100)*100)/100;
let registerTax = console.log(`California sales Tax is ${caSalesTaxPercent}%`);
registerTax;
let finalTotalRounded = Math.round(100*(saveSub*caSalesTax+saveSub))/100;
let registerTotal = console.log(`Your final total with tax is $${finalTotalRounded}.`);
registerTotal;
}
Why is the if statement executing on first attempt when i aswer askbuyMore prompt with "n"?