I do not get it why false is returned, am I missing something here?
const validInputs = (...inputs) => {
const check = inputs.every(inp => {
Number.isFinite(inp);
});
return check;
};
console.log(validInputs([1, 2, 3, 4, 5]));
I do not get it why false is returned, am I missing something here?
const validInputs = (...inputs) => {
const check = inputs.every(inp => {
Number.isFinite(inp);
});
return check;
};
console.log(validInputs([1, 2, 3, 4, 5]));
There are 2 issues, the callback isn't returning anything and you shouldn't rest the array((...input)
) as this will make inputs an array of array.
const validInputs = (inputs) => {
const check = inputs.every(inp => {
return Number.isFinite(inp);
});
return check;
};
console.log(validInputs([1, 2, 3, 4, 5]));