My results show four expected outputs, but each set ends with a fifth result as 'undefined'. I honestly don't see why it is doing that. Can you spot it and let me know? I will try that website you included as well.
@jlgehauthorJan 09.2022 — #I tried the 'fiddle' website and got the same results. I also spotted a bad practice(not critical) by not including a 'return' with my first 'const' declaration. I added it, but still got the same result. I wasn't expecting any real changes, but figured I would try it anyway.
@DaveyErwin explained correctly: ``<i> </i>const politelyDecline = (veg) => { // This line outputs "No xxx please. I will have pizza with extra cheese." // four times as required: console.log(No ${veg} please. I will have pizza with extra cheese.); }
const declineEverything = (arr) => { // After looping through the array, this line outputs "undefined" // as the return value of arr.forEach is undefined: return console.log(arr.forEach(politelyDecline)); }<i> </i>``