I tried shuffling a string with a fisher-yates shuffle, but although it properly gets the indexes and the values, it doesn't shuffle the string, what is wrong?
globalVar = 'I am GLOBAL'
function scrambler(anyString) {
let placeHolder = anyString
for (let i = placeHolder.length - 1; i >= 0; i--) {
let swapIndex = Math.floor(Math.random() * (i + 1))
let chartoSwap = placeHolder[swapIndex]
let currentChar = placeHolder[i]
placeHolder[i] = chartoSwap
placeHolder[swapIndex] = currentChar
}
return placeHolder
}
let scrambled = scrambler(globalVar)
console.log(scrambled)