Display Formatted Durations in TypeScript 🗓️ const formattedDuration = (duration: number): string => { const sec = duration % 60 const min = Math.floor(duration / 60) return `${min}min${sec > 0 ? ` ${sec}s` : ”}` } formattedDuration(600) //=> “10min” formattedDuration(640) //=> “10min 40s” formattedDuration(6640) //=> “110min 40s” Enter fullscreen mode Exit fullscreen mode ▶️ Try…

Read More