Add countChars function

master
Chloe Fontenot 🏳️‍⚧️ 2023-04-04 17:43:57 +07:00
parent abc805e9b4
commit 7946a6e925
1 changed files with 3 additions and 0 deletions

@ -47,6 +47,9 @@ function countChars(string) {
if (currentChar.charCodeAt(0) == 10 || currentChar.charCodeAt(0) == 13 || currentChar.charCodeAt(0) == 30 || currentChar.charCodeAt(0) == 115 || currentChar.charCodeAt(0) == 21 || currentChar.charCodeAt(0) == 118) {
currentChar = "newline";
}
if (currentChar.charCodeAt(0) == 32) {
currentChar = "whitespace"
}
if (letterCount[i] > 0) {
outputString += "Number of " + currentChar + "'s: " + letterCount[i] + "\n";
}