function addUpTo(n) { return n * (n + 1) / 2 } let test = 1000000000 let t1 = performance.now() addUpTo(test) let t2 = performance.now() console.log(`Time elapsed: ${(t2 - t1) / 1000} seconds.`)
Last updated 1 year ago
Was this helpful?