Get _m_s time format from milliseconds value I could have any value in milliseconds like:


  1040370


I must alert a specific converted time format : _m_s (ie:17m20s)

Here is how I do it: 



function ms(a){
var m = a/1000/60,
s = Math.floor(('0.'+(''+m).split('.')[1])*60);
m = (''+m).split('.')[0];
alert(m+'m'+s+'s');
}

ms(1040370);




What do you think?
Is it satisfactory or is there a better way to accomplish the same?
Seems overly complicated.  Let the builtin math and parsing functions do the work for you.  And name time values something like t.



const ms = t =&gt; alert( `${parseInt( t/1000 / 60 )}m${parseInt( t/1000 % 60 )}s` )
ms(1040370);