I’m doing a tutorial from FreeCodeCamp and learning JS. I’m doing a section on anonyous functions. I’m using the website runjs dot app to test and run Javascript. When I do this code:
const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
const squareList = (arr) => {
const squaredIntegers = arr.filter(num => Number.isInteger(num) && num > 0);
//Get squre of only positive integers in arr.
//First remove numbers < 0.
return squaredIntegers;
};
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);
The console shows me the correct array but on the next line it says “undefined.” Why does the undefined show in the console?
[ 4, 42, 6 ]
undefined
Could this be a quirk of the runjs.app website?
Thank you.