$ ./guess_the_languageRegex
Regex · easy · #56

What does this expression return?

'a   b  c'.replace(/\s+/g, ' ')
  1. 'a b c'
  2. 'abc'
  3. 'a b c'
  4. 'a b c'
\s+ matches each run of whitespace, which is collapsed into a single space.
Play Regex ▸