timing function javascript code example
Example: timing code in javascript
var output = "";
// Start timing now
console.time("concatenation");
for (var i = 1; i <= 1e6; i++) {
output += i;
}
// ... and stop.
console.timeEnd("concatenation");
var output = "";
// Start timing now
console.time("concatenation");
for (var i = 1; i <= 1e6; i++) {
output += i;
}
// ... and stop.
console.timeEnd("concatenation");