Skip to content

Instantly share code, notes, and snippets.

@manojrammurthy
Created December 3, 2015 15:33
Show Gist options
  • Select an option

  • Save manojrammurthy/3946b1911b96521f4b99 to your computer and use it in GitHub Desktop.

Select an option

Save manojrammurthy/3946b1911b96521f4b99 to your computer and use it in GitHub Desktop.
//to check if a string ends with the specific target
function end(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
if(str.substring((str.length-target.length),(str.length))==target){
return true;
}
else{
return false;
}
}
end("He has to give me a new name", "name");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment