const swapCase = (str: string) =>
        [...str]
          .map(c => (c === c.toLowerCase() ? c.toUpperCase() : c.toLowerCase()))
          .join('');
      
      Typescript language logo

      Swap case in string

      Codiga's TypeScript Recipes

      Creates a string with uppercase characters converted to lowercase and vice versa.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.