- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringManuplation.js
More file actions
Latest commit
32 lines (26 loc) · 664 Bytes
/
Copy pathStringManuplation.js
File metadata and controls
32 lines (26 loc) · 664 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
letday="Monday";
//printing the variable
console.log(day)
//lower case
console.log(day.toLowerCase());
//upper case
console.log(day.toUpperCase());
//getting the length
vardayLength=day.length;
console.log(dayLength);
//get the value of index 1
console.log(day[1]);
//last index
console.log(day.length-1)
//get substring
letdaySubString=day.substring(0,3);
console.log(daySubString);
//split the string
// return type of split is an array
letsplitDay=day.split("n");
console.log(splitDay);
lettodayDate="24";
letfutureDate="27";
//converting String into number
letdiff=parseInt(futureDate)-parseFloat(todayDate);
console.log(diff);