JS Built-ins
RegExptestbeginner

RegExp test() β€” no match

πŸ“– 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 false when the pattern does not match.

Challenge: Verify that /^\d+$/.test('abc') returns false.

πŸ’‘ Hints (1)
  • β€’ The ^ and $ anchors require the entire string to match