Skip to content

Commit b75f2a7

Browse files
Add files via upload
1 parent b22b9dc commit b75f2a7

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

Diff for: string method/string.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>string methos</title>
5+
</head>
6+
<body>
7+
<h1>String method</h1>
8+
9+
10+
11+
<script src="string.js"></script>
12+
</body>
13+
</html>

Diff for: string method/string.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
let text = " aayush rajdev";
2+
console.log(text);
3+
console.log(text.length);
4+
5+
// gives a piece of string
6+
let slice = text.slice(1 , 6);
7+
console.log(" ",slice);
8+
9+
// consider a negative as zero
10+
let substring = text.substring(-9 , 4);
11+
console.log(" " , substring);
12+
13+
// return a number of character same as second paramtre from starting position
14+
let substr = text.substr( 3, 10);
15+
console.log(" " , substr);
16+
17+
// convert string into array
18+
let arrayy = text.split("");
19+
console.log(arrayy);
20+
21+
// convert string into array
22+
let array = text.split("$");
23+
console.log(array);
24+
25+
// convert into uppercase
26+
let uppercase = text.toLocaleUpperCase();
27+
console.log(uppercase);
28+
29+
// convert into lowercase
30+
let lowercase = text.toLocaleLowerCase();
31+
console.log(lowercase);
32+
33+
// check whether character includes string or not
34+
let includes = text.includes("aayush");
35+
console.log(includes);
36+
37+
// gives a character from particular position
38+
let character = text.charAt(3);
39+
console.log(character);
40+
41+
// removes white spaces
42+
let trim = text.trim();
43+
console.log(trim.length);
44+
45+
// joines two string
46+
let text1 = "hey";
47+
let joined = text.concat(" ",text1);
48+
console.log(joined);

0 commit comments

Comments
 (0)