@@ -1404,6 +1404,7 @@ const name = 'Manthan';
1404
1404
1405
1405
The following are some of the most commonly used string methods in JavaScript:
1406
1406
1407
+ - **at()**
1407
1408
- **charAt()**
1408
1409
- **charCodeAt()**
1409
1410
- **concat()**
@@ -1416,19 +1417,39 @@ The following are some of the most commonly used string methods in JavaScript:
1416
1417
- **length**
1417
1418
- **localeCompare()**
1418
1419
- **match()**
1420
+ - **matchAll()**
1421
+ - **padEnd()**
1422
+ - **padStart()**
1419
1423
- **prototype**
1420
1424
- **repeat()**
1421
1425
- **replace()**
1426
+ - **replaceAll()**
1422
1427
- **search()**
1423
1428
- **slice()**
1424
1429
- **split()**
1425
1430
- **startsWith()**
1426
1431
- **substr()**
1427
1432
- **substring()**
1428
1433
- **toLocaleLowerCase()**
1434
+ - **toLocaleUpperCase()**
1435
+ - **toLowerCase()**
1436
+ - **toString()**
1437
+ - **toUpperCase()**
1438
+ - **trim()**
1439
+ - **trimEnd()**
1440
+ - **trimStart()**
1441
+ - **valueOf()**
1429
1442
1430
1443
[Back to Top⤴️](#table-of-contents)
1431
1444
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
+
1432
1453
**charAt()** - Returns the character at a specified index (position)
1433
1454
1434
1455
` ` ` javascript
@@ -1541,6 +1562,39 @@ console.log(myString); // Output: "The quick brown fox jumps over the lazy dog."
1541
1562
console .log (result); // Output: ["the", index: 30, input: "The quick brown fox jumps over the lazy dog.", groups: undefined]
1542
1563
` ` `
1543
1564
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
+
1544
1598
[Back to Top⤴️](#table-of-contents)
1545
1599
1546
1600
**prototype** - Allows you to add properties and methods to an object
0 commit comments