Question: Write a JavaScript function that accepts two parameters/arguments, a string and a letter (string) and the function will count the number of occurrences of

Write a JavaScript function that accepts two parameters/arguments, a string and a letter (string) and the  

Write a JavaScript function that accepts two parameters/arguments, a string and a letter (string) and the function will count the number of occurrences of the specified letter within the string and return that value. Example: the first argument is "hello" and the second parameter is "I". The function should return 2 because there are two is in "hello". Must use a function. The first parameter will be at least one character in length. The second parameter will be exactly one character in length and will always be a letter. The function should not care about case... "h" and "H" should both be counted as the same.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question is asking for a JavaScript function that takes two parameters a string and a singlelett... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!