I have a situation
i has 2 array1 as array1 = ["fruit","vegetables"];
and
array2 = [["apple","banana"],["tomato"]]; // index 0:represent fruit i,e (["apple","banana"]), index 1: vegetables i,e (["tomato"])
my question is : how do I push item from array1 to make my array2 look like
[["fruit","apple","banana"],["vegetables","tomato"]];
so that I can define index:0 as category .
MY data structure is 2 array array1 = ["fruit","vegetables"]; AND array2 = [["apple","banana"],["tomato"]];
if I can get the key value array pair, which would be good for me.
my data:
array1 = ["fruit","vegetables"]; array2 = [["apple","banana"],["tomato"]]; //expected output :[["fruit","apple","banana"],["vegetables","tomato"]];
source share