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 128 views
1 answer 166 views
2 answers 149 views
1 answer 139 views
2 answers 174 views
...