結果 : loop through array and return object javascript