Test name | Executions per second |
---|---|
for | 24.1 Ops/sec |
for ... of | 15.8 Ops/sec |
const text = new Array(2000000).fill("a").join("");
const text = new Array(2000000).fill("a").join("");
const string = new Array(text.length);
for (let i = 0; i < text.length; i++) {
string[i] = text[i];
}
const text = new Array(2000000).fill("a").join("");
const string = [];
for (const char of text) {
string.push(char);
}