JS Built-ins
RegExptestbeginner

RegExp test() β€” match found

πŸ“– Usage Example
const re = /\d+/
re.test('abc123') // β†’ true
re.test('abc')    // β†’ false

Use RegExp.test() to check whether a string matches the regular expression pattern.

RegExp.prototype.test()

test() returns true if the pattern matches anywhere in the string.

Challenge: Verify that /\d+/.test('abc123') returns true.

πŸ’‘ Hints (1)
  • β€’ test() searches for a match and returns true or false