Day 16: Exceptions - String to Integer

  • + 0 comments

    For Javascript, I'm also trying to solve this by try catch but it is very very basic concept. You do not need to use that, it solved by using isNAN() method and print the output accordingly.

    it can be soved by simply this one below line :

    console.log( isNaN(S) ? "Bad String" : S);