How to extract first middle last and name from a full name in TypeScript

1 Answer

0 votes
let str = "James John William";
  
const arr = str.split(" "); 
 
console.log(arr[0]);
console.log(arr[1]);
console.log(arr[2]);
 
 
 
 
/*
run:
 
"James"
"John"
"William"
 
*/

 



answered Nov 24, 2021 by avibootz

Related questions

1 answer 233 views
1 answer 180 views
1 answer 171 views
1 answer 172 views
1 answer 178 views
1 answer 152 views
...