Test name | Executions per second |
---|---|
If and modulo array | 549892.5 Ops/sec |
Ternary and slice concatenation | 628100.1 Ops/sec |
var z = 3661;
var t;
var y = [];
if (z>3600){
y.push(Math.floor(z/3600));
}
z%=3600;
if (z>60){
y.push(Math.floor(z/60));
}
z%=60;
if (z>0){
y.push(Math.floor(z));
}
t = y.join(":").replace(/\b(\d)\b/g,"0$1");
t = ("0"+Math.floor(z/3600).toString()).slice(-2)+":"+("0"+Math.floor(z%3600/60).toString()).slice(-2)+":"+("0"+Math.floor(z%3600%60).toString()).slice(-2)