1var password = '5236aaa121';
2
3for(var i = 0; i< password.length; i++) {
4 var numberOfRepeats = CheckForRepeat(i, password, password.charAt(i));
5 //do something
6
7}
8
9function CheckForRepeat(startIndex, originalString, charToCheck) {
10 var repeatCount = 1;
11 for(var i = startIndex+1; i< password.length; i++) {
12 if(originalString.charAt(i) == charToCheck) {
13 repeatCount++;
14 } else {
15 return repeatCount;
16 }
17 }
18 return repeatCount;
19}
20