Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Chrome 126
Windows
Desktop
6 months ago
Test name Executions per second
ternary 3011809.2 Ops/sec
Math.max 2616010.8 Ops/sec
Script Preparation code:
AخA
 
var a = Math.round(Math.random()*1000),b = Math.round(Math.random()*1000),c;
Tests:
  • ternary

     
    c = a>b?a:b;
  • Math.max

     
    c = Math.max(a,b);