Created
January 17, 2022 22:08
-
-
Save jbass86/babf16bf7f474e7920a8baf2056237e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const userString = "rhinoceros"; | |
const newString = []; | |
for (let letter of userString) { | |
console.log("letter is " + letter); | |
console.log("code is " + letter.charCodeAt(0)); | |
//this is just going to check for lower case | |
if (letter.charCodeAt(0) < "n".charCodeAt(0) || letter.charCodeAt(0) > "z".charCodeAt(0)) { | |
newString.push(letter); | |
} | |
} | |
let finalString = newString.join(); | |
//remove the commas from the string join | |
finalString = finalString.replace(/,/g, ""); | |
console.log("-----------------"); | |
console.log("final string is"); | |
console.log(finalString); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment