JSFiddle - React, Tailwind, and code Playground

JavaScript

String.prototype.shuffle = function () {
    var a = this.split(""),
        n = a.length;
    
    for (var i = n - 1; i > 0; i--) {
        var j = Math.floor(Math.random() * (i + 1));
        var tmp = a[i];
        a[i] = a[j];
        a[j] = tmp;
    }
    return a.join("");
}



alert("First Second".shuffle());
//I Want to shuffle First with its respective alphabets. Currently it is shuffling First with Second alphabets.. Want "sFtir Seocdn"