var arrNum = [1,2,3,4,5],
r = document.getElementById('result'),
t = [], // set a global variable to update.
double = function(n, index){ // use the index argument
t[index] = n * 2;
return t;
};
arrNum.forEach( double ); // get rid of foo entirely.
r.innerHTML = t; // update with the new value of t
<div id="result"></div>