code: function hasPattern(s, pattern) {
      const m = pattern.exec(s)
      return m != null && (m[1] || "").length % 2 === 0
  }
docs: Check a given string has a given pattern.
  @param {string} s A string to check.
  @param {RegExp} pattern A RegExp object to check.
  @returns {boolean} `true` if the string has the pattern.