var data =[{
"name": "jack",
"age": 10
}, {
"name": "jhon",
"age": 12
}];
var obje = {"name":{'data_one':0,'data_two':5},"age":{'data_one':8,'data_two':9}};
如何從此數組和對象中獲取以下結果。如何合併數組和對象
data[{"name":{"data_one":0,"data_two":5,"display_name":"jack"}
"age":{"data_one":8,"data_two":9,"display_name":10}},
{"name":{"data_one":0,"data_two":5,"display_name":"jhon"}
"age":{"data_one":8,"data_two":9,"display_name":12}}]
那你試試這麼遠嗎? –
data.forEach(功能(鍵,VAL){ VAR輸出= {}; Object.keys(OBJE).forEach(功能(鍵){ \t \t OBJE [鍵] [ 'DISPLAY_NAME'] =鍵[鍵]; }); key [val] = obje; }); –
我沒有得到輸入和輸出之間的關係... –