Add countChars function
This commit is contained in:
parent
abc805e9b4
commit
7946a6e925
@ -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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user