I'm trying to create a function that will remove first and last character from a string. Im converting the string into an array, and then I want to use shift() and pop() methods to remove the characters.
I seem to have a trouble with passing the splitStr variable that has array within to another function that will pop/shift the character.
What am I doing wrong?
let str = 'example';
let removeChar = function(str){
let splitStr = str.split("");
function popLast(splitStr){
let popStr = splitStr.pop();
}
function shiftFirst(splitStr){
let shiftStr = splitStr.shift();
}
}
removeChar(str);