JavaScript slice method 3

let pets = ['cat', 'dog', 'hamster', 'bunny', 'fish', 'parrot']

//Let's get last two using negative index
let lastTwo = pets.slice(-2);
//Result:
//(2) ['fish', 'parrot']

//We can also combine positive and negative index
//Let's copy everything from index 1 to, second to last, index -2

let combined = pets.slice(1, -2);
//Result:
// (3) ['dog', 'hamster', 'bunny']