Question · JavaScript and TypeScript course · Module 5: Advanced JavaScript

Advanced RegExp - the test() Method

What does the test() method of a regular expression return?

Answer options

  • A new string with replaced matches
  • An array of matched fragments
  • A boolean value (true if the pattern matches, false if not)
  • The index of the first match

You can check the correct answer by solving this task in the CodeWorlds game.