How to extract all words from a string in Node.js

1 Answer

0 votes
const s = "node.js c c++ c# python php";

let arr = s.split(" ");

for (let i = 0; i < arr.length; i++) {
     console.log(arr[i]);
}
 
 

 
/*
run:

node.js
c
c++
c#
pyth

*/

 



answered Feb 9, 2022 by avibootz
...