score:7

Arrow functions + hoisting variation with ES2015:

// Function
const milliseconds = (h, m, s) => ((h*60*60+m*60+s)*1000);

// Usage
const result = milliseconds(24, 36, 0);

// Contextual usage
const time = "34:26";
const timeParts = time.split(":");
const result = milliseconds(timeParts[0], timeParts[1], 0);
console.log(result);

This way you can componetize or make it service

score:9

This is simple.

var time = "34:26";
var timeParts = time.split(":");
console.log((+timeParts[0] * (60000 * 60)) + (+timeParts[1] * 60000));

score:9

Try this code:

var milisec = miliseconds(24,36,0);

function miliseconds(hrs,min,sec)
{
    return((hrs*60*60+min*60+sec)*1000);
}

Related Query