performance.now is designed specifically for timing code, and reports fractions of a millisecond.
Acceptance criteria
- 1.#out should show timed with performance.now.
performance.now is designed specifically for timing code, and reports fractions of a millisecond.
function timeIt(fn) { const start = Date.now(); fn(); return { clock: "Date.now", elapsed: Date.now() - start }; } const result = timeIt(function () {}); document.querySelector('#out').textContent = "timed with " + result.clock;
Output ready when you are
Press Run to render your code, or Submit to validate your solution.