合併兩個陣列我有兩個陣列(ARR1 & ARR2)這樣通過分組基於第一陣列的元件在Javascript
var arr1 = ["A","B","C"];
var arr2 = [["A","aa"], ["A","ab"], ["A","ac"],["B","ba"],["B","bb"],["B","bc"],["C","ca"],["C","cb"]];
我想將它們組在一起成爲根據的值在JavaScript第三陣列第一陣列。所需的輸出:
arr3 = [ ["A",["aa","ab","ac"]], ["B",["ba","bb","bc"] ], ["C",["ca","cb"]] ]
注:我有arr2開始,並能夠檢索第一個值,並刪除重複到arr1。
請指教。