I need to multiply any arguments I add, I just need to ignore the string in all cases and then multiply just numbers. and if all strings without numbers > the output should return // "All Is String"
function specialMix(...data) {
let result = 0;
for (let i = 0; i < data.length; i++) {
let check = parseInt(data[i]);
if (Number.isInteger(check)) {
result += check;
}
if (Number.isNaN(result)) {
result += check;
}
}
console.log(result);
}
specialMix(10, 20, 30); // 60
specialMix("10Test", "Testing", "20Cool"); // 30
specialMix("Testing", "10Testing", "40Cool"); // 50
// the problem here >>>
specialMix("Test", "Cool", "Test"); // All Is Strings