Using JavaScript, I need to check if a given string contains a sequence of repeated letters, like this:
\"aaaaa\"
How can I do t
var char = "abcbdf..,,ffffd,,,d,,,";
var tempArry={};
for (var i=0; i < char.length; i++) {
if (tempArry[char[i]]) {
tempArry[char[i]].push(char[i]);
} else {
tempArry[char[i]] = [];
tempArry[char[i]].push(char[i]);
}
}
console.log(tempArry);
This will even return the number of repeated characters also.