so I\'m trying to split a string into an array based on the amount of commas, how do I do that? Say my string is as such;
var string = \"abc, def, ghi, jkl,
You can use split and reduce also to achieve this :
let array = str.split(", ").reduce((prev, curr, i) => { if(i%4 === 0){ prev.push([]); } prev[prev.length - 1].push(curr); return prev; }, [])