Skip to content

Instantly share code, notes, and snippets.

@Viktorminator
Created October 14, 2016 09:52
Show Gist options
  • Save Viktorminator/6cb89780ee89327e6baa6f73f675e874 to your computer and use it in GitHub Desktop.
Save Viktorminator/6cb89780ee89327e6baa6f73f675e874 to your computer and use it in GitHub Desktop.
Exclamation marks series #1: Remove a exclamation mark from the end of string
function remove(s){
return (s.slice(-1) == '!') ? s.substring(0, s.length - 1) : s;
}
@Viktorminator
Copy link
Author

const remove = s => s.replace(/!$/, ''); // best practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment