代码如下: //灵感来自 //http://www.cnblogs.com/jkisjk/archive/2011/01/28/array_quickly_sortby.html var hasDuplicate = false; var sortBy = function(nodes){ var result = [], array = [], n = nodes.length, i = n, node; while(node = nodes[–n]){ (array[n] = new Number(~~node.sourceIndex))._ = node; } array.sort(fu