What does this candidate print for an input whose unit suffix should be rejected?
JavaScript
function timeoutMs(value) {
const seconds = Number.parseInt(value, 10);
if (!Number.isFinite(seconds) || seconds < 0) {
throw new TypeError("invalid timeout");
}
return seconds * 1_000;
}
console.log(timeoutMs("5s"));