6
New Strings Methods in ES6 JavaScript.
source link: https://techynidhi.hashnode.dev/new-strings-method-in-es6-javascript
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
New Strings Method in ES6 JavaScript
There are four methods that are introduced in Modern JavaScript:-
const name = 'nidhi'
The first one is startsWith the method
console.log(`${name}`.startsWith('n'));
result: true
The second one is endsWith
console.log(`${name}`.endsWith('n'));
result: false
The third one is includes
console.log(`${name}`.includes('n'));
result: true
The fourth one is repeat
console.log(`${name} `.repeat(3));
result: nidhi nidhi nidhi
Thankyou for reading my article, It means a lot for me :)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK