const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];
const squareList = (arr) => {
"use strict";
function inter (int) {
return int.isInteger;
};
const squaredIntegers = realNumberArray.filter(inter);
I don't know why this don't return an array of Int...
someone can help me?
isInteger
exists only on the Number
constructor
function inter (int) {
return Number.isInteger(); /// u not passing anything to that function
};
const a = realNumberArray.filter(inter);
u can check syntaxis /examples here@moigithub 16:39
const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];
const squareList = (arr) => {
"use strict";
function inter (int) {
return Number.isInteger(realNumberArray);
};
const a = realNumberArray.filter(inter);
const squaredIntegers = a.map(val => Math.pow(val, 2));
return squaredIntegers;
};
now yes, but it's still the same
now
@AlbertoGiambone Number.isInteger(realNumberArray);
the argument passed is..wrong. The usage of isInteger
is Number.isInteger(num)
so for example
Number.isInteger(1.2) //false
Number.isInteger(3) //true
You're passing array instead, also you should look up documentation of .filter()
and what parameters the callback function takes.