I have a Javascript object like
Object = { "ratio1" : "12+45*36",
"ratio2" : "34+45*16",
"ratio3" : "17+25"}
I am trying to split the values like the values before + in one array and values after + in one array . so the output should be like
Array1= ["12" , "34" , "17"]
Array2 = ["45" , "36" , "45","16","25"].
To perform this I am iterating through the keys and getting the values first then I am again iterating through the values array I am splitting it using
ratioArray.split("+");
This gave me [[" 12" , "45*36"], [" 34", "45*16"], [" 17", "25"]]
Now again I have iterate through all the three arrays and split using second delimiter. Is there any efficient way to perform this so that I can reduce these many iterations
str.split(/[+*]/)