← Back to challenges

How Many D's Are There?

JavaScriptHardalgorithmsstringslanguage_fundamentals

Instructions

Create a function that counts how many D's are in a sentence.

Examples

countDs("My friend Dylan got distracted in school.") ➞ 4

countDs("Debris was scattered all over the yard.") ➞ 3

countDs("The rodents hibernated in their den.") ➞ 3

Notes

  • Your function must be case-insensitive.
  • Remember to return the result.
  • Check the Resources for help.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: String or Integer?