js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Solve 'Exclamation marks series #1: Remove a exclamation mark from the end of string' #294

Closed odv closed 5 years ago

odv commented 5 years ago

https://www.codewars.com/kata/exclamation-marks-series-number-1-remove-a-exclamation-mark-from-the-end-of-string/train/javascript

RazvanBugoi commented 5 years ago
function remove(s){
  const input = s; 

  if (input[input.length - 1] === "!") {
    return input.slice(0, input.length - 1); 
  } 
    return input; 
}