summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus2020-10-15 19:11:26 +0200
committerHorus2020-10-15 19:11:26 +0200
commitbdc6a8e7d589fca1ac791de199938923099587a6 (patch)
tree87b8e5a738519b5ba9f0a5fce0430121c948c628
parentfe36e85bd72a082626704acee5cbdfdbefbbdaef (diff)
downloadbpm -bdc6a8e7d589fca1ac791de199938923099587a6.tar.gz
bugfix regarding copy by value != by reference
-rw-r--r--index.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/index.html b/index.html
index 240fe0a..17aac81 100644
--- a/index.html
+++ b/index.html
@@ -49,7 +49,8 @@
document.getElementById("showBpm").innerHTML = 0;
}
function display(bpm) {
- document.getElementById("showBpm").innerHTML = Math.round(median(bpm));
+ /* slice() copies by value, not by reference, so the median() doesn't mess with the array */
+ document.getElementById("showBpm").innerHTML = Math.round(median(bpm.slice()));
}
window.addEventListener("load",function() {
var lastClick = 0;
@@ -58,7 +59,6 @@
var d = new Date();
var t = d.getTime();
var seconds = ( t - lastClick ) / 1000;
- console.log(seconds)
if ( 0 != lastClick ) {