Last active
June 30, 2022 23:42
-
-
Save emtiazahmed27/b79629aae584ffbadb35e10adca6d647 to your computer and use it in GitHub Desktop.
ICBatch05-FinalExam (Problem Solving)
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
//write a function that truncates "a", "z", "c" | |
function truncate(str){ | |
let str2=str.toLowerCase(); | |
let res=""; | |
for(let i=0; i<str2.length; i++){ | |
if(str2[i]=="c"|| str2[i]=="a"||str2[i]=="z") res+=""; | |
else res+=str2[i]; | |
} | |
return res; | |
} | |
console.log(truncate("JAVASCRIPT")); | |
//output: jvsript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment