← Back to challenges

A Simple Timer

JavaScriptHardstringsnumberslogicmath

Instructions

Mubashir created a simple timer but he needs your help to make it readable inside a microcontroller.

Create a function that takes the number of seconds and returns the timer in "00:00:00" format.

Examples

simpleTimer(0) ➞ "00:00:00"

simpleTimer(59) ➞ "00:00:59"

simpleTimer(60) ➞ "00:01:00"

simpleTimer(3599) ➞ "00:59:59"

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Simulate the Game "Rock, Paper, Scissors"