Write Higher Order Arrow Functions yet again

Tell us what’s happening:
Code test is failing, telling me “loop should not be used.”

I see no loop.

I clearly missed the requirement that the number has to be greater than zero, but even when I just copy in the code from the solution (heresy!) I still get the no loop error.

Your code so far

const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];
const squareList = (arr) => {
  "use strict";
  // change code below this line
  // use filter to check for integers, then map the results to square them.
  const squaredIntegers = arr.filter(num => num % 1 === 0).map(num => num * num);
  // change code above this line
  return squaredIntegers;
// test your code
const squaredIntegers = squareList(realNumberArray);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36.

Link to the challenge:

The test is picking up on the extra comment you wrote. The comment has the word “for” in it that the tests are picking up. Delete that comment and you should be fine.

Thanks for the super-fast response… can I suggest that the testing code should ignore stuff that’s commented out? Thanks again!

Well, sometimes the challenges have comments in the code to aid in the challenge instructions. While it is possible for the test suite to be rewritten to ignore all other comments outside of those originally inserted into the challenges, I doubt it would be high priority as the test suite code would need to be rewritten to have this functionality and every single challenge’s testing criteria would have to be reviewed/modified to tell the test suite which parts of each initial challenge code is considered comments. That would be a huge undertaking based on the sheer number of challenges that already exist.

I agree it would be great if the tests would ignore user comments. However, this is one out of maybe 3-5 challenges where the camper’s extra comments code actually affect the results of the tests. The forum exists for just these type of rare situations.