Merge pull request #2362 from vsemozhetbyt/patch-1

Fix typo in 9.1 (Patterns and flags)
This commit is contained in:
Ilya Kantor 2020-12-07 18:37:44 +03:00 committed by GitHub
commit e87f130fc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,7 @@ In both cases `regexp` becomes an instance of the built-in `RegExp` class.
The main difference between these two syntaxes is that pattern using slashes `/.../` does not allow for expressions to be inserted (like string template literals with `${...}`). They are fully static.
Slashes are used when we know the regular expression at the code writing time -- and that's the most common situation. While `new RegExp`, is more often used when we need to create a regexp "on the fly" from a dynamically generated string. For instance:
Slashes are used when we know the regular expression at the code writing time -- and that's the most common situation. While `new RegExp` is more often used when we need to create a regexp "on the fly" from a dynamically generated string. For instance:
```js
let tag = prompt("What tag do you want to find?", "h2");