two dropdowns to select category, subcategory for personal coding tutorials

money in JS

// Define the prices in cents to avoid floating-point precision issues let price1 = { amount: 1050, currency: 'USD' }; // $10.50 let price2 = { amount: 575, currency: 'USD' }; // $5.75 // Add the amounts (in cents) let totalAmount = price1.amount + price2.amount; // Function to format the amount as currency function formatCurrency(amountInCents, currency) { // Convert cents to dollars const dollars = amountInCents / 100; // Format the number with 2 decimal places const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: currency, minimumFractionDigits: 2, maximumFractionDigits: 2 }); return formatter.format(dollars); } // Calculate and format the total let total = formatCurrency(totalAmount, 'USD'); console.log(total); // "$16.25"

Microphone Audio Visualizer