Given an array filled with integers, my goal is to generate a new array containing the averages of each integer and its following number. I attempted to achieve this using the map
function.
var arr = [1,2,3,4];
arr.map(function(a, b){
return (a + b / 2);
});
Although everything appears to work correctly when running this in the console, the problem arises when the challenge expects specific results. You can find the challenge here. Is there a simple mistake that I might be overlooking?