Hello I have several strings like this:
Name,Age,Location and Jon,20,London
How can I turn these strings into an array of arrays like so: Not sure if the correct term is a multidimensional array or Jagged array...
[["Name","Age","Location"],["Jon","20","London"]]
What I Tried:
I looked into doing Javascript string split and .push, but no success.
var a = "Name,Age,Location" ;
var b = "Jon,20,London";
a.push(b);
What Worked (I was stuck at the .split part, Please see answer from "Sam"):
var a = 'Name,Age,Location'.split(',');
var b = 'Jon,20,London'.split(',');
var c = [];
c.push(a)
c.push(b)
console.log(JSON.stringify(c))
// [["Name","Age","Location"],["Jon","20","London"]]