Tell us what’s happening:
I don’t understand how to get only integers…
I need the hint spelled out in plain English to better understand what is happening…
.filter(num => num > 0 && num % parseInt(num) === 0)
…and number divided by a binary parseInt? strictly equal to zero???
what?
Your code so far
const squareList = arr => {
// Only change code below this line
return arr
.filter(arr => arr > 0)
.map(arr => Math.sqrt(arr))
// Only change code above this line
};
That is a condition to return only integers and not decimals. The modulo % means that the remainder of a division must be zero.
" The modulo operation (abbreviated “mod”, or “%” in many programming languages ) is the remainder when dividing. For example, “5 mod 3 = 2” which means 2 is the remainder when you divide 5 by 3."
The main purpose of using the parseInt function is to extract a number from a string . This turns the returned value to an actual number.