How to convert part of comma separated string into array in JavaScript

1 Answer

0 votes
let s = "javascript,php,c,c++,python,c#,ruby";

let arr = s.split(',', 5);

console.log(arr);


    
    
/*
run:
    
["javascript", "php", "c", "c++", "python"]
    
*/

  

 



answered Jan 26, 2021 by avibootz

Related questions

...