Skip to content

Instantly share code, notes, and snippets.

@emtiazahmed27
Last active June 30, 2022 23:42
Show Gist options
  • Save emtiazahmed27/b79629aae584ffbadb35e10adca6d647 to your computer and use it in GitHub Desktop.
Save emtiazahmed27/b79629aae584ffbadb35e10adca6d647 to your computer and use it in GitHub Desktop.
ICBatch05-FinalExam (Problem Solving)
//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