How to get a substring between two indexes of a string in TypeScript

1 Answer

0 votes
const str: string = "TypeScript Programming";

let startIndex: number = 5;
let endIndex: number = 14;

const substring: string = str.substring(startIndex, endIndex);

console.log(substring); 


    
/*
run:
     
"cript Pro"
        
*/

 

 



answered Dec 16, 2024 by avibootz
...