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

     
    /^[a-z0-9]+$/i.test(string)
  • charCodeAt

    x
     
    function isAlphaNumeric(str) {
        for (let i = 0; i < str.length; i++) {
            let code = str.charCodeAt(i)
            if (!(code > 47 && code < 58) && // numeric (0-9)
                !(code > 64 && code < 91) && // upper alpha (A-Z)
                !(code > 96 && code < 123)) { // lower alpha (a-z)
                return false
            }
        }
        return true
    }
    isAlphaNumeric(string)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Regex
    charCodeAt

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 hours ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135 on Windows
View result in a separate tab
Test name Executions per second
Regex 21662038.0 Ops/sec
charCodeAt 29857242.0 Ops/sec