How can this Javascript be expressed more succinctly?
<p>I have some Python code that I'm porting to Javascript:</p>

<pre><code>word_groups = defaultdict(set)
for sentence in sentences:
    sentence.tokens = stemmed_words(sentence.str_)
    for token in sentence.tokens:
        word_groups[sentence.actual_val].add(token)
</code></pre>

<p>I don't know a lot about Javascript, so this was the best I could do:</p>

<pre><code>var word_groups = {}
for(var isent = 0; isent &lt; sentences.length; isent++) {
    var sentence = sentences[isent]
    sentence.tokens = stemmed_words(sentence.str_)
    for(var itoken = 0; itoken &lt; sentence.tokens.length; itoken++) {
        var token = sentence.tokens[itoken]
        if(!(sentence.actual_val in word_groups))
            word_groups[sentence.actual_val] = []
        var group = word_groups[sentence.actual_val]
        if(!(token in group))
            group.push(token)
    }
}
</code></pre>

<p>Can anyone suggest ways to make the javascript code look more like the python?</p>
