TypeScript · Exercise 5 of 5 Previous
Beginner
A Small Typed Bill
Add types to both functions: total takes an array of numbers and returns a number; formatRupees takes a number and returns a string.
The program must print ₹60.00. The checks also make sure total(["10", 20]) and formatRupees("60") are rejected.
What Check tests
- Your code has no type errors
total(["10", 20])is rejectedformatRupees("60")is rejected- The console prints
₹60.00
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Press Run to see the page.
Console
Nothing printed yet.