Day 16: Exceptions - String to Integer

  • + 0 comments

    My JS solution:

    const S = readLine();
        
        try {
            Number.isInteger(Number(S)) || (() => { throw new Error(); })();
            console.log(S);
        } catch {
            console.log("Bad String");
        }