function getSumOfValues(...arg) { return arg.reduce((sum, e) => sum += +e || 0, 0) } alert(getSumOfValues(1, -1, "лол")); alert(getSumOfValues(0, 1, 2, 5));