wordCount = {}; theWords = []; allWords = data.match(/\b\w+\b/g); //get all words in the document for(var i = 0; i < allWords.length; i = i + 1){ allWords[i] = allWords[i].toLowerCase(); var word = allWords[i]; if(word.length>5){ if(wordCount[word]){ wordCount[word] = wordCount[word]+1; } else{ wordCount[word] = 1; } } } var theWords = Object.keys(wordCount); // all words over 5 characters var result = ""; for(var i = 0; i < theWords.length; i = i + 1){ result = result + " " + theWords[i]; $("theWords.eq[i]").css("fontSize" , (wordCount.length + 50) + 'px'); } return result; }
I'm having problems with the syntax of the string "$ (" theWords [i] ....... "
I understand how simple the question is, not academic for the community, but I have been looking for this syntax for some time and cannot find any specific forum to fix my syntax error.
I am trying to change the font size depending on how many times the word appears in the document.
The word Count = count will appear.
theWords = all words to which I would like to apply the rule
source share