Answer:
Option 4 : Pulling out groups of characters from a string.
Step-by-step explanation:
- Slicing can be defined as choosing a specific part from the string and presenting it another string.
- Hence slicing() is a method used to extract required parts from the string.
- Syntax for method slice() is as follows:
string.slice(start, end)
- Where start and end are parameters for determining the part of the string to be extracted. These parameters work as an index to actual string.
For example:
Extract the characters from position 3 to 8:
var str = "Hello world!";
var res = str.slice(3, 8);