I have an input that could be as follows:
"a"
or
["a","b"]
or
[["a","b"],["c"]]
the goal is to convert them to a third template. I mean, I need a large array containing several arrays. as pseudo code, I try as below:
input=[].concat(input);
for (var t in input)
{
t=[].concat(input);
}
but it does not work for the second template, as I want [["a","b"]].
"a"=>[["a"]]
and
["a","b"]=>[["a","b"]]
and
[["a","b"],["c"]] => [["a","b"],["c"]]
Elnaz source
share