Cómo verificar los caracteres consecutivos en JavaScript

var password = '5236aaa121';

for(var i = 0; i< password.length; i++) {
    var numberOfRepeats = CheckForRepeat(i, password, password.charAt(i));
    //do something

}

function CheckForRepeat(startIndex, originalString, charToCheck) {
    var repeatCount = 1;
    for(var i = startIndex+1; i< password.length; i++) {
        if(originalString.charAt(i) == charToCheck) {
            repeatCount++;
        } else {
        return repeatCount;
        }   
    }
    return repeatCount;
}
Clean Camel