Example of implementing slice() method on array