JS Built-ins
RegExpsourcebeginner

RegExp source β€” typeof

πŸ“– Usage Example
const re = /hello world/i
console.log(re.source) // β†’ 'hello world'

Read RegExp.source to get the pattern text of the regular expression without slashes or flags.

RegExp.prototype.source

The source property always returns a string.

Challenge: Verify that typeof /abc/.source is 'string'.

πŸ’‘ Hints (1)
  • β€’ source always returns a string value