In this challenge, you are given an array and in turn, you must obtain a smaller array, following three steps:
Given an array of integers arr, implement a function that returns a new array applying the above algorithm.
antipodesAverage([1, 2, 3, 4]) ➞ [2.5, 2.5]
// Left part = [1, 2]
// Reversed right part = [4, 3]
// Array resulting from the sum of each pair = [5, 5]
// Each number is divided by two = [2.5, 2.5]
antipodesAverage([1, 2, 3, 4, 5]) ➞ [3, 3]
// The length of array is odd, number 3 (in the middle) is eliminated
// Left = [1, 2]
// Reversed right = [5, 4]
// Sum = [6, 6]
// Division by two = [3, 3]
antipodesAverage([-1, -2]) ➞ [-1.5]
// (-1 + -2) / 2 = [-1.5]
arr will contain at least two numbers.arr, numbers will always be whole (either positives or negatives), but the numbers into the returned final array can also be a float (either positives or negatives, see the examples #1 and #3).