I have a function which receives a string parameter, I need to convert this into an array. For example:
var param = "['Presidente', '', ''], ['Gerente de Operaciones', 'Presidente', ''], ['Gerente de Ventas', 'Presidente', '']";
function myFunc(data){
// DoSomethingHere
}
myFunc(param);
I need to convert data into an array, in this case it would have 3 positions. I tried doing Split() but didn’t get very far.
You can do it with eval(). Just wrap your contents inside an extra “[ ]” to make it an array
Like so: