Skip to content

Commit

Permalink
Replace single quotes in string literals with double quotes (#28571)
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 authored Aug 15, 2023
1 parent f616cb6 commit 8594c95
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ Any argument value that is {{jsxref("NaN")}} is treated as if it were `0`.
### Using substring()

The following example uses `substring()` to display characters from the
string `'Mozilla'`:
string `"Mozilla"`:

```js
const anyString = "Mozilla";

console.log(anyString.substring(0, 1)); // 'M'
console.log(anyString.substring(1, 0)); // 'M'
console.log(anyString.substring(0, 1)); // "M"
console.log(anyString.substring(1, 0)); // "M"

console.log(anyString.substring(0, 6)); // 'Mozill'
console.log(anyString.substring(0, 6)); // "Mozill"

console.log(anyString.substring(4)); // 'lla'
console.log(anyString.substring(4, 7)); // 'lla'
console.log(anyString.substring(7, 4)); // 'lla'
console.log(anyString.substring(4)); // "lla"
console.log(anyString.substring(4, 7)); // "lla"
console.log(anyString.substring(7, 4)); // "lla"

console.log(anyString.substring(0, 7)); // 'Mozilla'
console.log(anyString.substring(0, 10)); // 'Mozilla'
console.log(anyString.substring(0, 7)); // "Mozilla"
console.log(anyString.substring(0, 10)); // "Mozilla"
```

### Using substring() with length property
Expand Down Expand Up @@ -161,7 +161,7 @@ replaceString("World", "Web", "Brave New World");

Note that this can result in an infinite loop if `oldS` is itself a
substring of `newS` — for example, if you attempted to replace
'`World`' with '`OtherWorld`' here.
`"World"` with `"OtherWorld"` here.

A better method for replacing strings is as follows:

Expand Down

0 comments on commit 8594c95

Please sign in to comment.