From 48b5a747668065719ee57c637de493d016bcf55d Mon Sep 17 00:00:00 2001 From: atomiks Date: Thu, 12 Apr 2018 15:26:07 +1000 Subject: [PATCH] Update hz.md --- snippets/hz.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/snippets/hz.md b/snippets/hz.md index b05f18af6..1487b9b46 100644 --- a/snippets/hz.md +++ b/snippets/hz.md @@ -3,10 +3,7 @@ Returns the number of times a function executed per second. `hz` is the unit for `hertz`, the unit of frequency defined as one cycle per second. -Use `window.performance.now()` before and after the iteration loop to get the difference in milliseconds -to calculate the time elapsed executing the function `iterations` times, -using math to calculate the number of iterations per second. -Omit the second argument, `iterations`, to use the default of 100 iterations. +Use `window.performance.now()` to get the difference in milliseconds before and after the iteration loop to calculate the time elapsed executing the function `iterations` times. Return the number of cycles per second by converting milliseconds to seconds and dividing it by the time elapsed. Omit the second argument, `iterations`, to use the default of 100 iterations. ```js const hz = (fn, iterations = 100) => {