Created JS function to Get certain object from array of objects