Answered step by step
Verified Expert Solution
Question
1 Approved Answer
let table = document.getElementById ( ' myTable ' ) ; let subTotal = 0 ; for ( let row of table.rows ) { let priceCell
let table document.getElementByIdmyTable;
let subTotal ;
for let row of table.rows
let priceCell row.cells;
let quantityCell row.cells;
let price parseFloatpriceCelltextContent;
let quantity parseIntquantityCelltextContent;
let rowSubTotal price quantity;
priceCell.textContent rowSubTotal.toLocaleStringenUSstyle: 'currency', currency: 'USD';
priceCell.classList.addpricecolumn';
subTotal rowSubTotal;
let tax subTotal ;
let total subTotal tax;
let subTotalElement document.createElementp;
subtotalElement.textContent Subtotal: $subTotaltoLocaleStringenUS style: 'currency', currency: 'USD' ;
subtotalElement.classList.addsubtotal;
let taxElement document.createElementp;
taxElement.textContent Tax: $taxtoLocaleStringenUS style: 'currency', currency: 'USD' ;
taxElement.classList.addtax;
let totalElement document.createElementp;
totalElement.textContent Total: $totaltoLocaleStringenUS style: 'currency', currency: 'USD' ;
totalElement.classList.addtotal;
let tableFooter document.getElementByIdtableFooter;
tableFooter.appendChildsubtotalElement;
tableFooter.appendChildtaxElement;
tableFooter.appendChildtotalElement;
HOW DO I FIX THIS ERROR
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started