HTML Preparation code:
AخA
 
1
var string = "abe123";
Script Preparation code:
 
var string = "abe123";
Tests:
  • Regex

     
    let isLastNameValid = false;
    const THREE_DIGIT_REGEXP = /\d{3,}/;
    isLastNameValid = THREE_DIGIT_REGEXP.test(string);
  • Loop

     
    let isLastNameValid = false;
    let digits = 0;
    for(let i = 0; i < string.length; i++) {
      !isNaN(string.charAt(i)) && digits++;
    }
    isLastNameValid = digits >= 3;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Regex
    Loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36
Chrome 94 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Regex 10804066.0 Ops/sec
Loop 600001.6 Ops/sec