My dilemma involves a matrix (or multidimensional array) filled with non-unique values, similar to this example:
var matrix = [
[1, 3, 2, 4, 1],
[2, 4, 1, 3, 2],
[4, 3, 2, 1, 4]
]
I am in need of sorting one row within this matrix while ensuring that the other rows maintain their original order to preserve the column organization.
//Sorted matrix based on row 0
var sorted_matrix = [
[1, 1, 2, 3, 4],
[2, 2, 1, 4, 3],
[4, 4, 2, 3, 1]
]
If possible, I am looking for a solution using lodash.