How to get the second word of a string in TypeScript

1 Answer

0 votes
const str: string = "c typescript c# python c++ rust";

const secondWord: string = str.split(" ")[1];

console.log(secondWord);



/*
run:

"typescript"

*/

 



answered Oct 3, 2024 by avibootz

Related questions

...