Problem Statement
given a CSV string, convert the CSV string into an array of values using JavaScript
Solution
to convert the given CSV string into an array of values using JavaScript, use String split() method and pass comma character as delimiter/separator string
str.split(',')
Program
split the CSV string value in str
by comma
let str = 'apple,banana,cherry';
let valuesArray = str.split(',');
console.log(valuesArray[0]);
console.log(valuesArray[1]);
console.log(valuesArray[2]);