logo

Remove First and Last Character

It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry about strings with less than two characters.

function removeChar(str){
                      //You got this!
                       var output = [];
                       var numberOfCharacters = str.length;
                       for (var i = 0; i < numberOfCharacters; i++){
                         if (i != 0 && i != numberOfCharacters - 1){
                           output.push(str[i]);
                         }
                       }
                       return output.join('');
                     }