- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringMethods.js
More file actions
Latest commit
16 lines (15 loc) · 545 Bytes
/
Copy pathStringMethods.js
File metadata and controls
16 lines (15 loc) · 545 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
letstring="Hello World";
" Hello World ".trim();// "Hello World"
string.length;// 11
string.charAt(1);// e
string.startsWith("Hello");// true
string.endsWith("d")// true
string.includes("World")// true
string.indexOf("World")// 6
string.match(/[A-Z]/g);// ["H", "W"]
string.repeat(2)// "Hello WorldHello World"
string.replace("World","Earth");// "Hello Earth"
string.slice(6,10);// "Worl"
string.split(" ");// ["Hello" , "World"]
string.toLowerCase();// "hello world"
string.toUpperCase();// "HELLO WORLD"