Help with .forEach and functions

i am working on a little side project and no matter what i try, console.log(volumes) keeps printing “undefined”. i have tried every variation of return i can come up with and i only get errors or undefined. can someone shed some light on my error plz?

const pageTitle = ‘James jS Practice’;
const volumeSphere = function(radius) {
return (4/3)Math.PIradius**3;


const vol = volumeSphere(12);
console.log(vol + ’ units cubed’);

const radii = [5, 12, 22, 100, 69];
const volumes = radii.forEach( rad => {

return volumeSphere(rad)


Have a look at the documentation for the forEach method:

The documentation states that the Return value is undefined.

Perhaps you wanted to use the map method which returns “A new array with each element being the result of the callback function.”

ayyyy! worked like a charm. thx bro