Count Vowels in JavaScript

preview_player
Показать описание
How do we efficiently return the count of vowels in a string?

In this challenge, we iterate over the input (string) and increment our counter of vowels variable on each occasion that an index other than -1 is returned using the indexOf method on a string containing vowels.

This solution has a time complexity of O(n) as we only iterate the length of the input string.
Рекомендации по теме
Комментарии
Автор

I think this was the best explanation ive seen... and ive been struggling with this for hours!!

jamimajams
visit shbcf.ru