Javascript String messify(sx)

Description

Javascript String messify(sx)


String.prototype.messify=function(sx){
  return this.split("")//make into array
    .sort(//from ww w .j a  v  a 2s . c  om
      function(){
        //use sort to mess
        return Math.random()-sx;
      }
    )
    .join("");//make a string
}
function mess(s){
  return s.messify(0.5);
}



PreviousNext

Related