Which one is quicker?
let str = '';
for(let i=0; i<1000; i++) {
str += i;
}
or
let arr = [];
for(let i=0; i<1000; i++) {
arr.push(i);
}
let str = arr.join('');
I am curious about the speed difference between these two methods. I have developed a CSS parser that performs well, but struggles with larger stylesheets due to its speed. I am exploring ways to optimize it, and I am wondering if this would make any impact. Thank you in advance!