Update article.md
string with backslash is "1\\2" "1\2" is 1 and \2 Error: Octal escape sequences are not allowed in strict mode. without strict mode match returns null
This commit is contained in:
parent
ccc0e9327f
commit
38f4a7bfca
1 changed files with 1 additions and 1 deletions
|
@ -30,7 +30,7 @@ alert( "function g()".match(/g\(\)/) ); // "g()"
|
|||
If we're looking for a backslash `\`, then we should double it:
|
||||
|
||||
```js run
|
||||
alert( "1\2".match(/\\/) ); // '\'
|
||||
alert( "1\\2".match(/\\/) ); // '\'
|
||||
```
|
||||
|
||||
## A slash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue