mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +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() {
|
LinkedList.prototype.toArray = function() {
|
||||||
var output = [];
|
var output = new Array(this.length),
|
||||||
this.each(function(value) { output.push(value); });
|
index = 0;
|
||||||
|
this.each(function(value) { output[index++] = value; });
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user