Skip to content

Commit c06f0dd

Browse files
authored
string outputs without quotes (#1527)
string outputs without quotes
2 parents e15a63c + e70f039 commit c06f0dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

1-js/05-data-types/03-string/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ There are 3 methods in JavaScript to get a substring: `substring`, `substr` and
394394

395395
```js run
396396
let str = "st*!*ringify*/!*";
397-
alert( str.slice(2) ); // ringify, from the 2nd position till the end
397+
alert( str.slice(2) ); // 'ringify', from the 2nd position till the end
398398
```
399399

400400
Negative values for `start/end` are also possible. They mean the position is counted from the string end:
@@ -403,7 +403,7 @@ There are 3 methods in JavaScript to get a substring: `substring`, `substr` and
403403
let str = "strin*!*gif*/!*y";
404404

405405
// start at the 4th position from the right, end at the 1st from the right
406-
alert( str.slice(-4, -1) ); // gif
406+
alert( str.slice(-4, -1) ); // 'gif'
407407
```
408408

409409
`str.substring(start [, end])`
@@ -435,14 +435,14 @@ There are 3 methods in JavaScript to get a substring: `substring`, `substr` and
435435

436436
```js run
437437
let str = "st*!*ring*/!*ify";
438-
alert( str.substr(2, 4) ); // ring, from the 2nd position get 4 characters
438+
alert( str.substr(2, 4) ); // 'ring', from the 2nd position get 4 characters
439439
```
440440

441441
The first argument may be negative, to count from the end:
442442

443443
```js run
444444
let str = "strin*!*gi*/!*fy";
445-
alert( str.substr(-4, 2) ); // gi, from the 4th position get 2 characters
445+
alert( str.substr(-4, 2) ); // 'gi', from the 4th position get 2 characters
446446
```
447447

448448
Let's recap these methods to avoid any confusion:

0 commit comments

Comments
 (0)