Function Parameters

Parameters
πŸ‘¨β€πŸ’Ό We need utility functions for our e-commerce platform. Let's focus on functions that accept clear inputs and return the right type.
🐨 Open
index.ts
and create these functions:
  1. calculateTax(amount: number, rate: number) - Returns the tax amount
  2. formatPrice(cents: number) - Converts cents to dollar string (e.g., 1999 β†’ "$19.99")
  3. applyDiscount(price: number, discountPercent: number) - Returns discounted price
Return values are already familiar from 5.1β€”focus on parameter types here, but keep the return types explicit too.

Please set the playground first

Loading "Function Parameters"
Loading "Function Parameters"