Permutation using Recursion in Javascript

Through youtube, I’ve learned to obtain a multi-dimensional output of permutations using recursion, i.e anagrams with passing in an array of letters as an argument (i.e [‘a’, ‘b’, ‘c’]) but is there a way to modify the code to pass in a string instead ‘abc’ to obtain the output below??

Into
[ 'abc', 'bac', bca', 'acb', 'cab', 'cba' ]

This is my code. Is there a way to modify to obtain the desired result, using a string as the argument(i.e ‘abc’)?
Thank you, much appreciated

function anagrams(inputString){
  if(inputString.length ===0) return [[]];
  const stringArr = inputString;
  const firstEl = stringArr[0];
  const restArr = stringArr.slice(1);
  const anagramWithoutFirst = anagrams(restArr);
  const masterArr = [];

  anagramWithoutFirst.forEach(anagram => {
    for (let i=0; i<=anagram.length; i++){
      const anagramWithFirst = [...anagram.slice(0, i), firstEl, ...anagram.slice(i)]
      masterArr.push(anagramWithFirst)
    }
  })
  return masterArr
}

console.log(anagrams(['a', 'b', 'c']))