$ ./guess_the_languageRegex
Regex · medium · #4

What does this expression return?

['catfish', 'hotdog'].map(s => /^cat|dog$/.test(s))
  1. [true, true]
  2. [true, false]
  3. [false, true]
  4. [false, false]
Alternation has the lowest precedence, so the pattern means ^cat OR dog$, not ^(cat|dog)$.
Play Regex ▸