added JS snippet to pick middle elements from a given array