How to get the second word of a string in Node.js

1 Answer

0 votes
const str = "c node.js c# python c++ rust";

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

console.log(secondWord); 



/*
run:

node.js


*/

 



answered Oct 3, 2024 by avibootz

Related questions

1 answer 251 views
1 answer 256 views
2 answers 270 views
1 answer 236 views
2 answers 282 views
...