Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit 7772261

Browse files
zbranieckicaridy
authored andcommitted
Don't use Array.prototype.push in getCanonicalLocales (#213)
1 parent fb00b5a commit 7772261

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/8.intl.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ Intl.getCanonicalLocales = function (locales) {
1616
// 2. Return CreateArrayFromList(ll).
1717
{
1818
let result = [];
19-
for (let code in ll) {
20-
result.push(ll[code]);
19+
20+
let len = ll.length;
21+
let k = 0;
22+
23+
while (k < len) {
24+
result[k] = ll[k];
25+
k++;
2126
}
2227
return result;
2328
}

0 commit comments

Comments
 (0)