$ ./guess_the_languageRegex
Regex · easy · #55

What does this expression return?

'  hi  '.replace(/^\s+|\s+$/g, '')
  1. 'hi'
  2. 'hi '
  3. ' hi'
  4. ' hi '
The two alternatives strip leading and trailing whitespace; g lets both run.
Play Regex ▸