Horje
Shuffle a Sting in JavaScript Code Example
Shuffle a Sting in JavaScript
var shuffled = str.split('').sort(function(){return 0.5-Math.random()}).join('');
javascript shuffle string
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("");
}
console.log("the quick brown fox jumps over the lazy dog".shuffle());
//-> "veolrm  hth  ke opynug tusbxq ocrad ofeizwj"

console.log("the quick brown fox jumps over the lazy dog".shuffle());
//-> "o dt hutpe u iqrxj  yaenbwoolhsvmkcger ozf "




Javascript

Related
Object.values returns Code Example Object.values returns Code Example
npm concurrently Code Example npm concurrently Code Example
how to check all values of an array are equal or not in javascript Code Example how to check all values of an array are equal or not in javascript Code Example
remove # url vuejs Code Example remove # url vuejs Code Example
nodejs request api Code Example nodejs request api Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8