How to get the second word of a string in JavaScript

1 Answer

0 votes
const str = "c javascript c# python c++ rust";

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

console.log(secondWord); 



/*
run:

javascript

*/

 



answered Oct 3, 2024 by avibootz

Related questions

...