home ~ projects ~ socials

Get A Random Number Of Spaces (Or Other Characters) As A String In JavaScript

function randomSpacesBetween (min, max) { 
  const spaceCount = Math.floor(Math.random() * (max - min + 1) + min);
  const theSpaces = Array(spaceCount).fill(' ').join('');
  return theSpaces;
}
-- end of line --