結果 : get first and last element array javascript