Write Higher Order Arrow Functions --- Need help

Tell us what’s happening:

Can someone explain me this code line:

const squaredIntegers = arr.filter( (num) => num > 0 && num % parseInt(num) === 0).map  ( (num) => Math.pow(num,2) ); 

I dont understand why the solution have && num % parseInt(num)===0 and the function (num) =>Math.pow(num,2) What does Math.pow doing? and the if case && num % parseINt(num)===0 is everytime time true or not? example with integer 4.2: parseInt(4.2) makes from 4.2 into a Int 4. and 4 % 4 === 0 is true. So by any number, dont matter which number i take, the solution in this part is always true. so why we have this if case here?

Thanks and sorry for my bad english

Your code so far


const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
const squareList = (arr) => {
  "use strict";
  // change code below this line
  
  const squaredIntegers = arr.filter( (num) => num > 0 && num % parseInt(num) === 0).map  ( (num) => Math.pow(num,2) );
  // change code above this line
  return squaredIntegers;
};
// test your code
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/write-higher-order-arrow-functions

num % parseInt(num) === 0 is checking, in a somewhat confusing way, if a number is an integer.

So if num is 4.2, 4.2 % 4 === 0 is false. The remainder of 4.2 / 4 is not 0 - ie it is not an integer, so that value will not be included in the array that filter creates.

Would this make more sense?

Number.isInteger(num) && num > 0

ie the number is an integer AND the number is greater than 0.

Regarding Math.pow(), that I think you could have done with Googling. pow is short for power. If you had to guess, what would you assume raising a number to the power of 2 will do?