Your map callback is more complicated that it needs to be. You dont need an if statement or curly braces.
You can take a loot at this, specifically the second example and then figure out how to write that as an arrow function in the .map() to work for your problem. https://www.w3schools.com/jsref/jsref_map.asp
You need to make sure you are reading all the instructions. You are only supposed to be squaring positive integers. You are squaring all the positive numbers in the realNumberArray.
You need to make sure the final array only contains squares of positive integers.
I did not realize they were only supposed to do positive integers. I could have provided some better information otherwise. Going to start asking for links to the challenges so i can better understand what is needing to be accomplished.
They are not empty. They are actually the value undefined. You could use the filter method to make sure the array you use the map on only has positive integers. Then your map method would have no if statement logic and would only return squared values. The reason you are getting undefined is because if the number is not an integer (in your current map callback function) you implicitly return undefined. Functions which do not return values will always return undefined.
Also, the instructions say to square positive integers. Now you are squaring integers (both negative and positive).
Thefilter() is used when you want to output only the conditions you specify within the () which is usually a function.
the reduce()method will reduce the elements of your array to only one output . What the reduce() method should do with the elements of your array ,you write that code within the () which is is also a function.
the map() method is used on an array when you want to do something with each element of an array and output an array.