Formatting mm:ss to string with Javascript
I made a few changes to the function that I think improve readability.  By using parseInt() on the seconds, I eliminated the need to later set the secNum from 01 to 1.  Since we no longer need to change that, the minStr and secStr can be set with a ternary operator. I also used destructuring to clean up the splitting of the time.

To make it less error prone, you'd also want to make sure to do some sanity checks on the input, as mentioned in the comments.

All told, it ended up looking like this:



// Tests
console.log(formatTime('1:00'))
console.log(formatTime('1:01'))
console.log(formatTime('1:30'))
console.log(formatTime('0:30'))
console.log(formatTime('bad data'))

function formatTime(formattedTime) {
    // Set up minutes and seconds
    const [match, minNum, secNum] = formattedTime.match(/(\d+):(\d+)/) || [];
    
    // Make sure we're getting the data in correct
    if(!match) return false;

    // Get the correct minutes and seconds strings
    let minStr = (minNum === '1') ? 'minute' : 'minutes'
    let secStr = (parseInt(secNum) === 1) ? 'second' : 'seconds'

    // Return the formatted time
    if (parseInt(minNum) === 0) {
        return `${secNum} ${secStr}`;
    } else if (parseInt(secNum) === 0) {
        return `${minNum} ${minStr}`;
    } else {
        return `${minNum} ${minStr} ${parseInt(secNum)} ${secStr}`;
    }
}




This is making use of some ES6 additions, so if you want good browser support you'll need to make sure to run this through Babel.