JSchallenger

How many times does a character occur?

Viewed: 758
Attempted: 1117
Solved: 142
// Write a function that takes a two strings as arguments
// Return the number of times the first string occurs in the second string
//

function myFunction() {

return
}
Test Cases:
myFunction('m', 'How many times does the character occur in this sentence?')
Expected
2
myFunction('h', 'How many times does the character occur in this sentence?')
Expected
4
myFunction('?', 'How many times does the character occur in this sentence?')
Expected
1
myFunction('z', 'How many times does the character occur in this sentence?')
Expected
0