How to extract the first character from a string in TypeScript

1 Answer

0 votes
const str: string = 'typescript';
   
const firstCharacter: string = str[0];
   
console.log(firstCharacter);
    
    
    
/*
run:
          
"t" 
        
*/

 



answered Mar 13, 2024 by avibootz
edited Mar 13, 2024 by avibootz
...