Skip to content

Commit 18ce86f

Browse files
committed
added slice
1 parent 9dd0bdd commit 18ce86f

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 numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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);

0 commit comments

Comments
 (0)