Skip to content

Commit

Permalink
update card hilangkan rb dll
Browse files Browse the repository at this point in the history
  • Loading branch information
denicrizz committed Jun 6, 2024
1 parent c227fbe commit 541e334
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ fetch('superstore.json')
.then(data => {
// Menghitung total profit
const totalProfit = data.reduce((sum, order) => sum + order['Profit'], 0);
document.getElementById('totalProfit').textContent = `$${totalProfit.toFixed(2)} rb`;
document.getElementById('totalProfit').textContent = `$${totalProfit.toFixed(2)} `;

// Menghitung total sales
const totalSales = data.reduce((sum, order) => sum + order['Sales'], 0);
document.getElementById('totalSales').textContent = `$${totalSales.toFixed(2)} jt`;
document.getElementById('totalSales').textContent = `$${totalSales.toFixed(2)} `;

// Menghitung total order
const totalOrders = data.length;
document.getElementById('totalOrders').textContent = `${totalOrders} rb`;
document.getElementById('totalOrders').textContent = `${totalOrders} `;

// Menghitung unit terjual
const unitsSold = data.reduce((sum, order) => sum + order['Quantity'], 0);
document.getElementById('unitsSold').textContent = `${unitsSold.toFixed(1)} rb`;
document.getElementById('unitsSold').textContent = `${unitsSold.toFixed(1)} `;

// Menghitung jumlah customer
const totalCustomers = new Set(data.map(order => order['Customer ID'])).size;
Expand Down

0 comments on commit 541e334

Please sign in to comment.