Fix typo in 9.1 (Patterns and flags)
This commit is contained in:
parent
79c9513796
commit
5be2c046a5
1 changed files with 1 additions and 1 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue