HTML Preparation code:
AخA
 
1
var string = "passw)odas4gsdfsdf";
Script Preparation code:
 
var string = "passw)odas4gsdfsdf";
Tests:
  • RegEx

     
    let isPasswordValid = /(?=.*[0-9])/.test(string);
  • For Loop

     
    let isPasswordValid = false;
    for (let i = 0; i < string.length; i++)
    {
        if (string[i] >= '0' && string[i] <= '9')
        {
          isPasswordValid = true;
          break;
        }
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    RegEx
    For 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 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Chrome 87 on Mac OS X 11.1.0
View result in a separate tab
Test name Executions per second
RegEx 8804039.0 Ops/sec
For Loop 476523.8 Ops/sec