mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Preallocating in LinkedList's toArray method (#5488)
This commit is contained in:
parent
bfa062f23d
commit
c0dc2669c0
@ -89,8 +89,9 @@ LinkedList.prototype.each = function(callback) {
|
||||
};
|
||||
|
||||
LinkedList.prototype.toArray = function() {
|
||||
var output = [];
|
||||
this.each(function(value) { output.push(value); });
|
||||
var output = new Array(this.length),
|
||||
index = 0;
|
||||
this.each(function(value) { output[index++] = value; });
|
||||
return output;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user