tracks/javascript/exercises/word-count/example.js in trackler-2.2.1.37 vs tracks/javascript/exercises/word-count/example.js in trackler-2.2.1.38
- old
+ new
@@ -3,12 +3,12 @@
function Words() {}
Words.prototype.count = function (input) {
var counts = {};
var words = input.toLowerCase()
- .replace(/[,."\/!&@$%\^\*;:{}()¡¿?]/g, ' ')
- .replace(/\s'(\w+)'\s/, ' '+'$1'+' ')
- .match(/\S+/g);
+ .replace(/[,."\/!&@$%\^\*;:{}()¡¿?]/g, ' ')
+ .replace(/\s'(\w+)'\s/, ' ' + '$1' + ' ')
+ .match(/\S+/g);
words.forEach(function (word) {
counts[word] = counts.hasOwnProperty(word) ? counts[word] + 1 : 1;
});
return counts;