JavaScript Problem: Finding All Occurrences of a Character in a String

preview_player
Показать описание
In today's tutorial we are going to deal with a JavaScript problem that has to do with analyzing a string. We will create a function that will accept a string and a character and then return an array that contains the index of all occurrences for that character.

Would you like to help keep this channel going?

Tutorials referred to in this video:

For more resources on JavaScript:

#javascript #AllThingsJavaScriptLLC
Рекомендации по теме
Комментарии
Автор

Hi Steven. What is the reason to use the spread operator results inside the array? I really didn't understand.

polliluiz
Автор

How to solve this?
Write a JavaScript program that accepts two strings as user input. The program should determine the first occurrence of the second string within the first string. And then print into the console the second string along with the last remaining characters of the first string. Print the string in capital letters.

Sample Input:
“University”
“ver”


Sample output:
“VERSITY”

TheMarketingManU