JSFiddle - React, Tailwind, and code Playground

by alirokni

JavaScript

function anno(word) {
  //word.split('');
  var count = word.length;
  var res = '',
    tmp = '',
    i;
  var rand;
  /*
var b = list[y];
list[y] = list[x];
list[x] = b;  
  */
  for (i = 0; i < count; i++) {
    rand = Math.floor(Math.random() * count);
    tmp = word[i];
    word[i] = word[rand];
    word[rand] = tmp;
    // word[rand] = word[i];
    res += word[rand];
  }
  console.log(res);
}
anno('react');