Given two strings
Sample Input 1
JavaScript
S
Sample Output 1
Script
Sample Input 2
Language
air
Sample Output 2
Language
function Slicer(param1,param2){
if(param1.includes(param2)){
let index = param1.indexOf(param2);
console.log(param1.slice(index));
}else{
console.log(param1);
}
}
Slicer("Javascript","s");
//output - script
//Slicer("Language","air");
//output - Language
Comments
Leave a comment