Travis build: 1015

This commit is contained in:
30secondsofcode
2018-01-04 09:55:00 +00:00
parent da0ef8ffc2
commit ea115f4d05
4 changed files with 59 additions and 5 deletions

View File

@ -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)