在JavaScript中,我有2个数组。如何对基于二维数组的一维数组进行排序?
一个是一维数组,另一种是二维数组
一维数组的内容是:
a[0] = "Germany";
a[1] = "England";
a[2] = "America";
a[3] = "France";
二维数组内容是:
a[0][0] = "America";
a[1][0] = "England";
a[2][0] = "France";
a[3][0] = "Germany";
我怎样才能让一维数组的排列顺序与二维数组相同?
也就是说,我想一维数组的最终结果是:
a[0] = "America";
a[1] = "England";
a[2] = "France";
a[3] = "Germany";
是否有可能为我做这样的动作?
这是否需要*排序*,因为这两个数组是不一样的,或者可能你只是* *扁平化的二维数组来获得相同的结果呢? – deceze 2011-02-17 03:09:18