File tree 1 file changed +36
-0
lines changed
Methods Extended Studies/String Methods Extended Study
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+ // TOPIC /////////////////////////////////////////////////////////////////////////////////////////////////////
3
+ //
4
+ // Array Method: .slice()
5
+ //
6
+ // SYNTAX ////////////////////////////////////////////////////////////////////////////////////////////////////
7
+ //
8
+ // string.slice()
9
+ //
10
+ // SUMMARY ///////////////////////////////////////////////////////////////////////////////////////////////////
11
+ //
12
+ // • .slice() extracts a selection of a string and returns it as a new string without modifying
13
+ // the original string.
14
+ // •
15
+ //
16
+ // EXAMPLES //////////////////////////////////////////////////////////////////////////////////////////////////
17
+ //
18
+ // EXAMPLE 1:
19
+ //
20
+ // RESOURCES /////////////////////////////////////////////////////////////////////////////////////////////////
21
+ //
22
+ //
23
+ //
24
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////
25
+
26
+
27
+ // EXAMPLE 1:
28
+
29
+ const myString = "This is a string" ;
30
+
31
+ function sliceIt ( string ) {
32
+ const sliceString = string . slice ( )
33
+ console . log ( sliceString ) ;
34
+ }
35
+
36
+ sliceIt ( myString ) ;
You can’t perform that action at this time.
0 commit comments