Tests:
  • wiki

    AخA
     
    var container = "MRKU576275";
    var con = container.toUpperCase();
    for (i = 0; i < 10; i++) {
        var n = con.substr(i, 1);
        if (i < 4) {
            n = "0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ".indexOf(con.substr(i, 1));
        };
        n *= Math.pow(2, i);
        sum += n;
    };
    sum %= 11;
    sum %= 10;
    return sum
  • me

     
    var container = "MRKU576275";
    var con = container.toUpperCase();
    var p = [1,2,4,8,16,32,64,128,256,512];
    var s = 0;
    for (var n=0;n<10;n++) {
        if (n<4) {
            var c = con.charCodeAt(n)-55;
            s+=(Math.floor(c/10.2)+c)*p[n];
        } else {
            s+=Number(con.charAt(n))*p[n];
        };
    };
    var sum = s % 11 % 10;
    return sum
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    wiki
    me

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 years ago)
Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101 Firefox/53.0
Firefox 53 on Windows 7
View result in a separate tab
Test name Executions per second
wiki 0.0 Ops/sec
me 3035002.8 Ops/sec