Created
February 26, 2024 05:18
-
-
Save canalun/12f7d9226d13c431682371f723feccc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// after runnig this code on the console, click click click as fast as possible. | |
let a = null | |
let results = [] | |
window.addEventListener('click', (e) => { | |
if (a === null){ | |
a = performance.now() | |
return | |
} | |
const b = performance.now() | |
const result = b-a; | |
results.push(result) | |
const ave = results.reduce((prev,acc)=>{return prev+acc},0) / results.length | |
const v = Math.sqrt(results.reduce((prev,acc)=>{return prev+(acc-ave)*(acc-ave)},0)/results.length) | |
console.log( | |
ave, | |
v | |
) | |
a = b | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
result on 2024/2/20
121.31562500447035 11.141619882320713