-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.js
More file actions
41 lines (26 loc) · 666 Bytes
/
string.js
File metadata and controls
41 lines (26 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
let str = "neelkanth vashist";
//length of string
let len = str.length;
console.log(len);
//Slice method
let sarr=str.slice(2,7);
console.log(sarr);
//Replace method
let replacearr=str.replace("e","o");
console.log(replacearr);
//Upper case
let uppercase = str.toUpperCase();
console.log(uppercase);
//lowercase
let lowercase = str.toLowerCase();
console.log(lowercase);
//Concate method
let firstname = "Neelkanth";
let lastname = "vashist";
let fullname = firstname.concat(lastname);
console.log(fullname);
let fullname2 = firstname+lastname;
console.log(fullname2);
//split-Returns a array
let splitted = str.split('e');
console.log(splitted);