Réponse

for (word of storyWords){if(word[word.length-1]==='.'|| word[word.length-1]==='!'){ sentencesCount+=1}
}

Colonne
Explication

iterate over the array storyWords and add 1 to the sentence counter variable sentencesCount for each word that has a period or exclamation mark as its final character. let sentencesCount = 0
for (word of storyWords){
if(word[word.length-1]==='.'|| word[word.length-1]==='!'){
sentencesCount+=1
}
}

console.log(sentencesCount);

Question

iterate over the array storyWords and add 1 to the sentence counter variable sentencesCount for each word that has a period or exclamation mark as its final

Thématique