big int max tests

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
with reduce
function findMaxBigInt(values) {
  if (values.length === 0) {
    throw new Error('Values array is empty');
  }
  return values.reduce((acc, cur) => (acc > cur ? acc : cur));
}

findMaxBigInt([BigInt(123), BigInt(456), BigInt(789)])
ready
with forEach
function bigint_max(...args){
    if (args.length < 1){ throw 'Max of empty list'; }
    m = args[0];
    args.forEach(a=>{if (a > m) {m = a}});
    return m;
}

bigint_max([BigInt(123), BigInt(456), BigInt(789)])
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.