Travis build: 1015
This commit is contained in:
@ -7,7 +7,7 @@ Use `Object.entries()` with `Array.filter()` to keep only non-zero values.
|
||||
Use `Array.map()` to create the string for each value, pluralizing appropriately.
|
||||
Use `String.join(', ')` to combine the values into a string.
|
||||
|
||||
``` js
|
||||
```js
|
||||
const formatDuration = ms => {
|
||||
if (ms < 0) ms = -ms;
|
||||
const time = {
|
||||
@ -15,7 +15,7 @@ const formatDuration = ms => {
|
||||
hour: Math.floor(ms / 3600000) % 24,
|
||||
minute: Math.floor(ms / 60000) % 60,
|
||||
second: Math.floor(ms / 1000) % 60,
|
||||
millisecond: Math.floor(ms) % 1000,
|
||||
millisecond: Math.floor(ms) % 1000
|
||||
};
|
||||
return Object.entries(time)
|
||||
.filter(val => val[1] !== 0)
|
||||
|
||||
Reference in New Issue
Block a user