Created
November 9, 2018 03:48
-
-
Save AminBusiness/ebadaa19226284fffe344700bdb749ab to your computer and use it in GitHub Desktop.
// source https://jsbin.com/gavovuh
This file contains 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
<script id="jsbin-javascript"> | |
//Challenge 11 | |
//Change every letter of the string to the one that follows it and capitalize the | |
//Vowels | |
function letterChanges(str){ | |
let newStr = str.toLowerCase().replace(/[a-z]/gi, function(char) | |
{ | |
if(char === 'z' || char === 'Z') | |
{ | |
return 'a'; | |
} else | |
{ | |
return String.fromCharCode(char.charCodeAt() + 1); | |
} | |
}); | |
newStr = newStr.replace(/a|e|i|o|u/gi, function(vowel) { | |
return vowel.toUpperCase(); | |
}); | |
return newStr; | |
} | |
const output = letterChanges('Hello There'); | |
console.log(output); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">//Challenge 11 | |
//Change every letter of the string to the one that follows it and capitalize the | |
//Vowels | |
function letterChanges(str){ | |
let newStr = str.toLowerCase().replace(/[a-z]/gi, function(char) | |
{ | |
if(char === 'z' || char === 'Z') | |
{ | |
return 'a'; | |
} else | |
{ | |
return String.fromCharCode(char.charCodeAt() + 1); | |
} | |
}); | |
newStr = newStr.replace(/a|e|i|o|u/gi, function(vowel) { | |
return vowel.toUpperCase(); | |
}); | |
return newStr; | |
} | |
const output = letterChanges('Hello There'); | |
console.log(output); | |
</script> |
This file contains 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
//Challenge 11 | |
//Change every letter of the string to the one that follows it and capitalize the | |
//Vowels | |
function letterChanges(str){ | |
let newStr = str.toLowerCase().replace(/[a-z]/gi, function(char) | |
{ | |
if(char === 'z' || char === 'Z') | |
{ | |
return 'a'; | |
} else | |
{ | |
return String.fromCharCode(char.charCodeAt() + 1); | |
} | |
}); | |
newStr = newStr.replace(/a|e|i|o|u/gi, function(vowel) { | |
return vowel.toUpperCase(); | |
}); | |
return newStr; | |
} | |
const output = letterChanges('Hello There'); | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment