Find the word in a string that has the most repeated characters
I liked that you split the string into words using a regular expression.  That helps a lot.

Your code formatting (indentation and braces) is haphazard.  It shouldn't be that hard to follow the standard conventions for code formatting, and it will make things easier for yourself if you do.

I think your function tries to do too much.  It would help to break down the problem.  I've extracted part of the problem into a self-contained task:


  Given a word, how many times does the most frequent character appear?


For that, you can write a function, and test it (e.g. mostFrequentCount('hello') should return 2).

/**
 * Given an array (or a string), returns the number of times the most frequent
 * element (or character) appears.
 */
function mostFrequentCount(elements) {
    var bins = {};
    for (var i = 0; i &lt; elements.length; i++) {
        bins[elements[i]] = (bins[elements[i]] || 0) + 1;
    }
    var max = 0;
    for (var c in bins) {
        max = Math.max(max, bins[c]);
    }
    return max;
}


That should simplify the main code.  Rather than commenting each line (in effect writing everything once for the computer and once for other programmers), I've tried to make the code read like English by using very human-friendly variable names.

function wordsWithMaxRepeatedCharacters(string) {
    var maxRepeatedCharacters = 0, wordsWithMaxRepeatedCharacters = [];

    var words = string.split(/\W/);
    for (var w = 0; w &lt; words.length; w++) {
        var word = words[w];
        var numRepeatedCharacters = mostFrequentCount(word);

        if (maxRepeatedCharacters &lt; numRepeatedCharacters) {
            maxRepeatedCharacters = numRepeatedCharacters;
            wordsWithMaxRepeatedCharacters = [word];
        } else if (maxRepeatedCharacters == numRepeatedCharacters) {
            wordsWithMaxRepeatedCharacters.push(word);
        }
    }
    return wordsWithMaxRepeatedCharacters;
}