Skip to content

Commit ce05d73

Browse files
fix: technical keywords in Best Practices
1 parent cbc7a40 commit ce05d73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ console.log(str.slice(4, 6)); // "Sc" (from index 4 to 6, exclusive)
10681068

10691069
## Best Practices
10701070

1071-
### 1. Prefer slice() Over substring() and substr()
1071+
### 1. Prefer `slice()` Over `substring()` and `substr()`
10721072

10731073
```javascript
10741074
// ✅ GOOD: Use slice() for consistency and modern JavaScript practices
@@ -1080,7 +1080,7 @@ const usernameOld = email.substring(0, email.indexOf('@'));
10801080
const domainOld = email.substr(email.indexOf('@') + 1);
10811081
```
10821082

1083-
### 2. Use Negative Indices with slice() for Cleaner Code
1083+
### 2. Use Negative Indices with `slice()` for Cleaner Code
10841084

10851085
```javascript
10861086
// ✅ GOOD: Using negative indices with slice()

0 commit comments

Comments
 (0)