JS Cómo barajar la algoritm de matriz. El algorith Fisher-Yates

// @ts-check

// The Fisher-Yates algorith

(() => {
  let arr = [1, 2, 3, 4, 5];

  const shuffleArray = (array) => {
    for (let i = array.length - 1; i > 0; i--) {
      const j = Math.floor(Math.random() * (i + 1));
      const temp = array[i];
      array[i] = array[j];
      array[j] = temp;
    }
  };

  shuffleArray(arr);
  console.log(arr);

  shuffleArray(arr);
  console.log(arr);

  shuffleArray(arr);
  console.log(arr);
})();
Condemned Corncrake