JSFiddle - React, Tailwind, and code Playground

by de Montalembert Jonathan

HTML

10.99-10.99*1/7

JavaScript

date = new Date();
// uncomment the below to test with an other date
// date.setDate(27);
today = date.getDay();
days = [1, 7, 6, 5, 4, 3, 2];
document.writeln('You\'ll only need to pay for today plus the ' + parseInt(today + 1) + ' remaining days since the week start on monday<br>');

document.write('The total amount will be 99+49+10.99-(10.99*' + days[today] + ')/7=$' + parseFloat(99 + 49 + 10.99 - (10.99 * days[today]) / 7).toFixed(2))