How to Make JavaScript Slice an Array: an Example