Easy Tutorial
❮ Prop Area Href Met Element Setattribute ❯

JavaScript global Property


Definition and Usage

The global property is used to return whether the regular expression has the "g" flag.

If the g flag is set, this property is true; otherwise, it is false.

Syntax


Browser Support

All major browsers support the global property.


Example

Check if the regular expression has the g flag:

var str = "Visit tutorialpro!";
var patt1 = /RUN/g;

if (patt1.global) {
    document.write("g flag is set!");
} else {
    document.write("g flag is not set!");
}

❮ Prop Area Href Met Element Setattribute ❯