-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut50.html
29 lines (28 loc) · 882 Bytes
/
tut50.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Javascript string function</title>
</head>
<body>
<script>
var str="This is string";
// console.log(str);
var position=str.indexOf("is");
console.log(position);
var position=str.lastIndexOf("is");
console.log(position);
var substr=str.slice(1, 6);
console.log(substr);
var replaced=str.replace("string","Priyanshu");
console.log(str);
console.log(replaced);
console.log(str.toUpperCase());
console.log(str.toLowerCase());
var withwhitespaces=" This is white spaces ";
console.log(withwhitespaces.trim());
</script>
</body>
</html>