How to convert a comma separated string to array in JavaScript

1 Answer

0 votes
const str = "javascript,php,c,c++,python";
 
const arr = str.split(',');
 
console.log(arr);
 
 
     
     
/*
run:
     
["javascript", "php", "c", "c++", "python"]
     
*/

 



answered Jan 26, 2021 by avibootz
edited Jun 19, 2022 by avibootz
...