str.shuffle()

๐Ÿ”ฐ JS โŸฉ Types โŸฉ String โŸฉ methods

/**
 * โญ๏ธ shuffleString()
 *    shuffle string
 * @param str [string] string to shuffle
 */
export function shuffleString(str){
    return shuffle(str.split('')).join('');
}

// โญ๏ธ string.shuffle()
String.prototype.shuffle = function(){
    return shuffleString(this);
}

Last updated