I have array like
let array = ["a,b,c"]
I want to convert It like this
let array = ["a","b","c"]
CodePudding user response:
let array = ["a,b,c"]
console.log(array.join().split(","))
CodePudding user response:
You can use Array.prototype.flatMap
. It allows you to return arrays which fill be flattened.
let array = ["a,b,c"];
console.log(array.flatMap(item => item.split(",")));
CodePudding user response:
Use split
const array = ["a,b,c"];
const output = array[0].split(",");
console.log(output);