Given the following 2D array:
1230 | this is a test
1278 | my new test
1230 | test2
7654 | testing...
I am looking to transform the array so that values in the first column are unique and the second column stores the concatenated text associated with each unique value. The desired output should look like this:
1230 | this is a test -- test2
1278 | my new test
7654 | testing...
To achieve this, I know I need to first sort the array by the first column before merging.
Below is the code snippet for sorting the array by the first column:
var x = exp_arr.sort(function(a,b){ return a[0] > b[0] ? 1 : -1; });
alert(x);
While I have that part figured out, I'm unsure about how to proceed with the merging process. Any suggestions or guidance on this would be greatly appreciated.