var str = "12a45bcAAB+#$%^";
var count1 = 0;
var count2 = 0;
var count3 = 0;
var count4 = 0;
for (var i = 0; i < str.length; i++) {
if (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') {
count1++;
} else if (str.charAt(i) >= 'a' && str.charAt(i) <= 'z') {
count2++;
} else if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
count3++;
} else {
count4++;
}
}
console.log(count1, count2, count3, count4);