Skip to content
Advertisement

How to append element from a multi-dimensional array to each element of another multi-dimensional array

I am trying to append elements from a multi-dimensional list into a 2nd multi-dimensional list. Here is the code I wrote –

JavaScript

The output I am getting is –

JavaScript

It adds elements of 2nd list to the beginneing of 1st list. The output I am trying to get is of sort –

JavaScript

I want to add inner_most element of my_list after each element of ref_list instead of just adding it once in the end.

Advertisement

Answer

Slight change to your code:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement