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