Skip to content

Commit 7ffbc9c

Browse files
fix: Common substring() Pitfalls
1 parent b06a17d commit 7ffbc9c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎data/blog/software-development/web-development/frontend/javascript/slice-vs-substring-vs-substr-complete-javascript-string-methods-comparison.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ console.log(str.slice(-4, 10)); // "ript" (from index -4 which is positi
654654
// slice() correctly interprets negative start (6), substring() treats negative start as 0
655655
```
656656

657-
#### Common substring() Pitfalls
657+
#### Common `substring()` Pitfalls
658658

659659
```javascript
660660
// Pitfall 1: Assuming negative indices work like slice()

0 commit comments

Comments
 (0)