JS Array.slice() code example
Example 1: javascript slice array
const FRUITS = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var citrus = FRUITS.slice(1, 3);
var fromTheEnd = FRUITS.slice(-3, -1);
Example 2: 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 3: slice() javascript
let ourString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
ourString.slice(0, 11);
console.log(ourString.slice(0, 11));
string.slice(start, end);