slice example
Example 1: slice()
/"slice() copies or extracts a given number of elements to a new array"/
let weatherConditions = ['rain', 'snow', 'sleet', 'hail', 'clear'];
let todaysWeather = weatherConditions.slice(1, 3);
Example 2: slice javascript
const string="Hi my name is mezen";
string.slice (2);
string.slice (6);
string.slice (3,7)
Example 3: slice in javascript
JavaScript Array slice() Method The slice() method returns the selected elements in an array, as a new array object. The slice() method selects the elements starting at the given start argument, and ends at, but does not include, the given end argument. Note: The original array will not be changed.