Repository navigation
Expand file tree
/
Copy pathstring.js
More file actions
67 lines (35 loc) · 1.88 KB
/
Copy pathstring.js
File metadata and controls
67 lines (35 loc) · 1.88 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ===================== S T R I N G ==========================
// string is stored as a object it can be written in two ways
const nam="shivani"
console.log(nam);
const surname=new String("Pawade")
console.log(surname);
// to concatinate the string in two methods
console.log(nam + " " + surname);
console.log(`my name is ${nam} and my surname is ${surname}`); //template string
// S T R I N G METHODS
console.log(nam.length); // L E N G T H
console.log(nam.slice(2,6)); // S L I C E
console.log(nam.substring(1,7)); // S U B S T R I N G
console.log(nam.toUpperCase()); // TO U P P E R C A S E
console.log(nam.charAt(5)); // C H A R A T
console.log(nam.indexOf("h")); // I N D E X O F
let email="shivani@gmail.com"
console.log((email.replace("@","--"))); // it replace the value
console.log((email.includes('gmail'))); // includes
console.log((email.split("@"))); // split
// ================================================================================================================
// N U M B E R and M A T H
number=10000
console.log(number.toString().length); //length
console.log(Math);
console.log(Math.abs(-9));
console.log(Math.sqrt(25));
console.log(Math.random());
const numbe= 1000000000
console.log(numbe.toLocaleString('en-In'));
// =====================================================================================================================
// D A T E AND D A T E
const todaysDate=new Date()
console.log(todaysDate);
console.log(todaysDate.toDateString());