Void Functions

Void Functions
πŸ‘¨β€πŸ’Ό Many functions in real applications don't return valuesβ€”they perform actions. These are called side effects, and they return void.
Examples of side effects:
  • Logging information
  • Updating the UI
  • Sending data to a server
  • Playing a sound
🐨 Open
index.ts
and create these exported functions. Each takes a message: string and returns void (no useful return value):
  1. logInfo β€” logs with an [INFO] prefix, e.g. [INFO] Application started
  2. logError β€” logs with an [ERROR] prefix, e.g. [ERROR] Connection failed
  3. logWithTimestamp β€” logs with an ISO timestamp in brackets, e.g. [2024-01-15T12:00:00.000Z] User logged in (use the current time)

Required exports

logInfo, logError, logWithTimestamp

Completion criteria

  • Each function is callable and returns undefined (the runtime value of void)
  • When you call them, console output uses the prefix/timestamp formats above
πŸ’° Void functions don't return a valueβ€”annotate the return type as void.

Please set the playground first

Loading "Void Functions"
Loading "Void Functions"