I have a string like below.
sections = "12A,13B,14C"
But I need [12A, 13B, 14C]
for future use. How to create array from above string?
I have a string like below.
sections = "12A,13B,14C"
But I need [12A, 13B, 14C]
for future use. How to create array from above string?
You have to use split method for that to split your string data into array values, have a look to updated code
var sections = "12A,13B,14C";
sections = sections.split(',');
console.log(sections);
Hope this will help! Just use split method of JS.
sections = "12A,13B,14C"
let array = sections.split(',');
console.log(array)