• + 1 comment
    function reverseString(s) {
        try{
            let reversed = s.split("").reverse().join("")
            console.log(reversed);
        } catch (e){
            console.log(e.message);
            console.log(s);
        }
    }
    
    • + 0 comments

      function revarseString(s) {

      try {
      
          // Check if the input is a string and reverse it
      
          let reversed = s.split("").reverse().join("");
          console.log(reversed);
      } catch (error) {
          // Catch any exceptions (e.g., if s is not a string)
          console.log("s.split is not a function");
          console.log(s); // Print the original value of s
      }
      

      }