JavaScript RegExp constructor attribute

Definition and usage

constructor The attribute returns the function that creates the prototype of RegExp.

For regular expressions, the constructor attribute returns:

function RegExp() { [native code] }

instance

The constructor attribute returns the constructor function of the regular expression.

let pattern = /Hello World/g;
let text = pattern.constructor;

try it yourself

syntax

regexp.constructor

return value

function RegExp() { [native code] }

Υποστήριξη περιηγητών

constructor Είναι χαρακτηριστικά ECMAScript1 (ES1).

Όλοι οι περιηγητές υποστηρίζουν πλήρως το ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη