How to extract all words from a string in TypeScript

1 Answer

0 votes
const s = "typescript c c++ c# python php";

let arr = s.split(" ");

for (let i = 0; i < arr.length; i++) {
     console.log(arr[i]);
}
 
 

 
/*
run:

"typescript" 
"c"
"c++"
"c#"
"python"
"php"

*/

 



answered Feb 9, 2022 by avibootz
...