Ad
  • Custom User Avatar

    str.match returns null if there is no character match and an array of matched characters if there are matches.

    x && x.length checks that x !== null because null.length will throw an error whereas array.length will return the count.