Skip to content

Commit

Permalink
Merge pull request mdn#1782 from SebastianZ/regexp-prototype-hasindices
Browse files Browse the repository at this point in the history
Added example for RegExp.prototype.hasIndices
  • Loading branch information
escattone committed Apr 5, 2021
2 parents 6c39979 + a5efc59 commit eb6bfed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion live-examples/js-examples/regexp/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"title": "JavaScript Demo: RegExp.prototype[@@split]",
"type": "js"
},
"regexPrototypeDotAll": {
"regexpPrototypeDotAll": {
"exampleCode": "./live-examples/js-examples/regexp/regexp-prototype-dotall.js",
"fileName": "regexp-prototype-dotall.html",
"title": "JavaScript Demo: RegExp.prototype.dotAll",
Expand All @@ -90,6 +90,12 @@
"title": "JavaScript Demo: RegExp.prototype.global",
"type": "js"
},
"regexpPrototypeHasIndices": {
"exampleCode": "./live-examples/js-examples/regexp/regexp-prototype-hasindices.js",
"fileName": "regexp-prototype-hasindices.html",
"title": "JavaScript Demo: RegExp.prototype.hasIndices",
"type": "js"
},
"regexpPrototypeIgnoreCase": {
"exampleCode": "./live-examples/js-examples/regexp/regexp-prototype-ignorecase.js",
"fileName": "regexp-prototype-ignorecase.html",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const regex1 = new RegExp('foo', 'd');

console.log(regex1.hasIndices);
// expected output: true

const regex2 = new RegExp('bar');

console.log(regex2.hasIndices);
// expected output: false

0 comments on commit eb6bfed

Please sign in to comment.