Its use is obvious!

| December 23rd, 2008

Here’s a JavaScript function, buried deep within a 5000+ line JavaScript file with absolutely no documentation, let alone variables that might indicate what the function’s use is.

function checkCheck(ct) {
        var v1;
        var v2 = false;
        var x;
        for(x = 1; x <= ct; x++) {
                v1 = $('check_' + x);
                if(v1) {
                        if(v1.checked == 1) {
                                return true;
                                break;
                        }
                        else {
                                continue;
                        }
                }
        }
        return v2;
}

Aside from the weirdness of the return/break/continue statements, v2 is never even used other than just to return false!

One Response to “Its use is obvious!”

  1. OnlyAman Says:

    hi there,
    Isn’t that my code? I wrote that for a reason on a copyrighted site… I am going to sue you for infringement, that code is used for the Large Hadron Collider, once we fix it v2 will magically switch when we create a large enough black hole.

    Don’t make fun of me… I am a genius!

Leave a Reply