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;
}
Mam kłopoty ze składnią wiersza „$ (” thewords [i] .......”zmiany rozmiaru czcionki według liczyć słowa
Zdaję sobie sprawę, jak łatwo z pytanie to jest, a nie akademickich dla społeczności, ale jestem grzebanie z tej składni przez chwilę i nie można znaleźć żadnego konkretnego forum, aby poprawić mój błąd składniowy
Próbuję zmienić rozmiar czcionki zgodnie z do czasu pojawienia się tego słowa w dokumencie:
wordCount = liczba wyświetleń
theWo rds = wszystkie słowa Chciałbym, aby reguła miała zastosowanie do:
to '$ ("thewords [I]")' elementy w dokumencie? Czy możesz dołączyć "html" do pytania? – guest271314
poprawne, program od teraz poprawnie policzy każde słowo według inspektora sieci. –
Czy '" theWords "' a 'className' of elements? Wypróbuj '$ (" .Words "). Eq (i)' – guest271314