js数组sort排序
pxcs:function(){
var that = this;
var arr = new Array();
arr = [[“中猫猫er”, “E7555大号”, “包背带”, “150”, “0.16”], [“卜要见、卜要贱”, “CA0913大”, “包背垫”, “333”, “0.18”]];
arr.sort(function (x, y) {
return x[1].localeCompare(y[1]);
});
that.setData({
arr:arr
})
console.log(this.data.arr);
console.log(that.data.arr)
},
pxcs2: function () {
var that = this;
console.log(this.data.arr)
console.log(that.data.arr);
var an_arr = that.data.arr
//以下这个排序为什么 会影响that.data.arr
an_arr.sort(function (x, y) {
return x[3].localeCompare(y[3]);
});
},
