DEV Community

Discussion on: Daily Challenge #167 - Return String As Sorted Blocks

Collapse
 
mellen profile image
Matt Ellen

Someone ask on SO, and I answered:

For funzies, here's how I would have approached the problem:

const isLower = new RegExp('[a-z]');
const isUpper = new RegExp('[A-Z]'); 
const isDigit = new RegExp('[0-9]');
const isDigitOrUpper = new RegExp('[0-9A-Z]');
const isDigitOrLower = new RegExp('[0-9a-z]');
const isLowerOrUpper = new RegExp('[a-zA-Z]');

function lowerUpperNumber(a, b)
{
  if(isLower.test(a) &&