← Back to challenges

Count the Capital Letters

JavaScriptHardstringsloopslanguage_fundamentalsregex

Instructions

Given a string of letters, how many capital letters are there?

Examples

capitalLetters("fvLzpxmgXSDrobbgMVrc") ➞ 6

capitalLetters("JMZWCneOTFLWYwBWxyFw") ➞ 14

capitalLetters("mqeytbbjwqemcdrdsyvq") ➞ 0

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Hot Pics of Danny DeVito!