最佳答案
我有一个对象数组。我要将选定的对象移动到数组中的最后一个位置。如何在 javascript 或 jquery 中实现这一点?
下面是我的一些代码:
var sortedProductRow = this.product_row;
for (var s in sortedProductRow) {
if (sortedProductRow[s]["parent_product_type"] != "")
// Move this object to last position in the array
}
我通过一个 for 循环来遍历这个过程,我希望输出是有序的,这样所有没有“ father _ product _ type”值的对象都会优先排序,然后是那些有值的对象。