How to create array from a string using String.prototype.split() in JavaScript

1 Answer

0 votes
const arr = "javascript, c, c++, java".split(", ");

console.log(arr);



/*
run:
  
[ 'javascript', 'c', 'c++', 'java' ]

*/

 



answered May 2, 2024 by avibootz
...