I’m trying to remove the first and last character from a string.
I have converted it to an array using split –
arr= str.split(" ") --, but when I tried to remove the first and last using slice –
newArr = arr.slice(0,-1) – the console only returned empty brackets. This should work. I don’t why I’m returning empty brackets. Am I missing something on split or misunderstanding slice? I don’t think that I am.