var output = ""; // Start timing now console.time("concatenation"); for (var i = 1; i <= 1e6; i++) { output += i; } // ... and stop. console.timeEnd("concatenation");