How to split part of a string into an array of strings in TypeScript

1 Answer

0 votes
let str = "TypeScript is a programming language superset of JavaScript"; 

const splitted = str.split(" ", 4); 

console.log(splitted)
 
 
 
 
/*
run:
  
["TypeScript", "is", "a", "programming"] 
  
*/

 



answered Oct 26, 2021 by avibootz
...