[Solved] Implementing a Fisher–Yates shuffle loop is not working


array, i and currentWord were never defined anywhere:

function shuffleWord(word) {
  var array = word.split('');
  var m = array.length, t, i;

  // While there remain elements to shuffle…
  while (m) {

    // Pick a remaining element...
    i = Math.floor(Math.random() * m--);

    // And swap it with the current element.
    t = array[m];
    array[m] = array[i];
    array[i] = t;
  }

  return array.join('');
}

5

solved Implementing a Fisher–Yates shuffle loop is not working