JavaScript RegExp constructor Property
❮
RegExp Object
❯
Example
The constructor property returns a regular expression's constructor function:
var patt = new RegExp("Hello World", "g");
var res = patt.constructor;
Try it Yourself »
Definition and Usage
In JavaScript, the constructor property returns the constructor function for an object.
The return value is a reference to the function, not the name of the function:
For JavaScript regular expressions the constructor property returns function RegExp() { [native code] }
For JavaScript numbers the constructor property returns function Number() { [native code] }
For JavaScript strings the constructor property returns function String() { [native code] }
Browser Support
Property | |||||
---|---|---|---|---|---|
constructor | Yes | Yes | Yes | Yes | Yes |
Syntax
RegExpObject.constructor
Technical Details
Return Value: | function RegExp() { [native code] } |
---|---|
JavaScript Version: | ECMAScript 1 |
❮
RegExp Object
❯