Format Uptime
Easy · Formatting
process.uptime() returns how many seconds the process has been running, as a decimal number like 93784.52.
Write a function formatUptime(seconds) that drops the fraction and returns a string like "1d 2h 3m 4s":
- units are days (d), hours (h), minutes (m) and seconds (s), separated by one space
- leave out units that are zero: 3600 → "1h"
- 0, or less than one second → "0s"
Next: Format File Size