Skip to content

Commit 53bd27c

Browse files
committedAug 10, 2024
chore: Update string methods in README.md
1 parent d866397 commit 53bd27c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
 

‎README.md

+54
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@ const name = 'Manthan';
14041404
14051405
The following are some of the most commonly used string methods in JavaScript:
14061406
1407+
- **at()**
14071408
- **charAt()**
14081409
- **charCodeAt()**
14091410
- **concat()**
@@ -1416,19 +1417,39 @@ The following are some of the most commonly used string methods in JavaScript:
14161417
- **length**
14171418
- **localeCompare()**
14181419
- **match()**
1420+
- **matchAll()**
1421+
- **padEnd()**
1422+
- **padStart()**
14191423
- **prototype**
14201424
- **repeat()**
14211425
- **replace()**
1426+
- **replaceAll()**
14221427
- **search()**
14231428
- **slice()**
14241429
- **split()**
14251430
- **startsWith()**
14261431
- **substr()**
14271432
- **substring()**
14281433
- **toLocaleLowerCase()**
1434+
- **toLocaleUpperCase()**
1435+
- **toLowerCase()**
1436+
- **toString()**
1437+
- **toUpperCase()**
1438+
- **trim()**
1439+
- **trimEnd()**
1440+
- **trimStart()**
1441+
- **valueOf()**
14291442
14301443
[Back to Top⤴️](#table-of-contents)
14311444
1445+
**at()** - Returns the character at a specified index (position)
1446+
1447+
```javascript
1448+
let myString = "Hello World!";
1449+
1450+
console.log(myString.at(0)); // Output: "H"
1451+
```
1452+
14321453
**charAt()** - Returns the character at a specified index (position)
14331454
14341455
```javascript
@@ -1541,6 +1562,39 @@ console.log(myString); // Output: "The quick brown fox jumps over the lazy dog."
15411562
console.log(result); // Output: ["the", index: 30, input: "The quick brown fox jumps over the lazy dog.", groups: undefined]
15421563
```
15431564
1565+
**matchAll()** - Returns an iterator of all results matching a string against a regular expression
1566+
1567+
```javascript
1568+
let myString = "The quick brown fox jumps over the lazy dog.";
1569+
1570+
let result = myString.matchAll(/the/gi);
1571+
1572+
console.log(myString); // Output: "The quick brown fox jumps over the lazy dog."
1573+
console.log(result); // Output: [RegExpStringIterator]
1574+
```
1575+
1576+
**padEnd()** - Pads a string with a specified value at the end
1577+
1578+
```javascript
1579+
let myString = "Hello";
1580+
1581+
let newString = myString.padEnd(10, " World!");
1582+
1583+
console.log(myString); // Output: "Hello"
1584+
console.log(newString); // Output: "Hello World!"
1585+
```
1586+
1587+
**padStart()** - Pads a string with a specified value at the start
1588+
1589+
```javascript
1590+
let myString = "Hello";
1591+
1592+
let newString = myString.padStart(10, " World!");
1593+
1594+
console.log(myString); // Output: "Hello"
1595+
console.log(newString); // Output: " World!Hello"
1596+
```
1597+
15441598
[Back to Top⤴️](#table-of-contents)
15451599
15461600
**prototype** - Allows you to add properties and methods to an object

0 commit comments

Comments
 (0)
Failed to load comments.