I have a 2D array like below:
1230 | this is a test
1278 | my new test
1230 | test2
7654 | testing...
I want to transform the array so that values are unique in the first column and the second column stores the concatenated text associated with that particular value. See example below.
1230 | this is a test -- test2
1278 | my new test
7654 | testing...
I understand I should first sort the array by its first column and then do the merging.
Here is the code 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);
I am a bit lost about how to do the merging. Your suggestions are most welcome