DEV Community

Discussion on: Can you hack this? #2

Collapse
 
vicainelli profile image
Vinicius Cainelli • Edited

Without convert to Number

const isEven = (n) => {
  const rgx = new RegExp('^\d*[02468]$')
  return rgx.test(n)
};
Enter fullscreen mode Exit fullscreen mode