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 248 views
1 answer 184 views
1 answer 176 views
1 answer 182 views
1 answer 188 views
1 answer 159 views
...