formatSeconds
Returns the ISO format of the given number of seconds.
- Divide
s
with the appropriate values to obtain the appropriate values forhour
,minute
andsecond
. - Store the
sign
in a variable to prepend it to the result. - Use
Array.prototype.map()
in combination withArray.prototype.floor()
andString.prototype.padStart()
to stringify and format each segment. - Use
String.prototype.join(':')
to combine the values into a string.