Announce Total: Log and Return
Sometimes a function should both return a value and log a message for users. You’ll implement a helper that sums two numbers, logs the result, and returns it.
This exercise reinforces writing a clear return type while also verifying console output.
Your Task
- Complete the function announceTotal(a: number, b: number): number.
- Compute the sum and console.log('Total:', sum).
- Return the sum.
Examples
- announceTotal(3, 4) logs Total: 7 and returns 7.
- announceTotal(10, 0) logs Total: 10 and returns 10.