I am attempting to make a conditional statement where the code will only run if it is a real number 90 vs a string number "90". I don't know what to type into the number part in my conditional statement. I have tried using Number and I have also tried variations of typeof() method. My code is listed below. Thank you
function sumAll(start, end) {
let x = 0;
array = [];
if (start === Number && end === Number) {
if (start < end && start >= 0) {
for (let i = start; i <= end; i++) {
array.push(i);
console.log(array);
x = i + x;
}
return x;
} else if (start > end) {
for (let i = start; i >= end; i--) {
array.push(i);
// console.log(array);
x = i + x;
}
return x;
} else {
return 'ERROR';
}
} else {
return 'ERROR not a number';
}
}
console.log(sumAll(10, 90));
sumAll(10, "90")
// expect(sumAll(10, "90")).toEqual('ERROR');
```