ects/Object/constructor)
    2. [ ` Object.prototype.__proto__ ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) Deprecated 
  13. Methods 
    1. [ ` Object.prototype.__defineGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__) Deprecated 
    2. [ ` Object.prototype.__defineSetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineSetter__) Deprecated 
    3. [ ` Object.prototype.__lookupGetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupGetter__) Deprecated 
    4. [ ` Object.prototype.__lookupSetter__() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__lookupSetter__) Deprecated 
    5. [ ` Object.prototype.hasOwnProperty() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty)
    6. [ ` Object.prototype.isPrototypeOf() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf)
    7. [ ` Object.prototype.propertyIsEnumerable() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable)
    8. [ ` Object.prototype.toLocaleString() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toLocaleString)
    9. [ ` Object.prototype.toString() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString)
    10. [ ` Object.prototype.valueOf() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf)

##  In this article

  * Try it 
  * Description 
  * Examples 
  * Specifications 
  * Browser compatibility 
  * See also 

#  RegExp.prototype.sticky

The **` sticky ` ** accessor property of [ ` RegExp ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instances returns
whether or not the ` y ` flag is used with this regular expression.

##  Try it

##  Description

` RegExp.prototype.sticky ` has the value ` true ` if the ` y ` flag was used;
otherwise, ` false ` . The ` y ` flag indicates that the regex attempts to
match the target string only from the index indicated by the [ ` lastIndex `
](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex)
property (and unlike a global regex, does not attempt to match from any later
indexes).

The set accessor of ` sticky ` is ` undefined ` . You cannot change this
property directly.

For both sticky regexes and [ global ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global) regexes:

  * They start matching at ` lastIndex ` . 
  * When the match succeeds, ` lastIndex ` is advanced to the end of the match. 
  * When ` lastIndex ` is out of bounds of the currently matched string, ` lastIndex ` is reset to 0. 

However, for the [ ` exec() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) method, the
behavior when matching fails is different:

  * When the [ ` exec() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) method is called on a sticky regex, if the regex fails to match at ` lastIndex ` , the regex immediately returns ` null ` and resets ` lastIndex ` to 0. 
  * When the [ ` exec() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) method is called on a global regex, if the regex fails to match at ` lastIndex ` , it tries to match from the next character, and so on until a match is found or the end of the string is reached. 

For the [ ` exec() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) method, a regex
that's both sticky and global behaves the same as a sticky and non-global
regex. Because [ ` test() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) is a simple
wrapper around ` exec() ` , ` test() ` would ignore the global flag and
perform sticky matches as well. However, due to many other methods special-
casing the behavior of global regexes, the global flag is, in general,
orthogonal to the sticky flag.

  * [ ` String.prototype.matchAll() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/mat