From bdc6a8e7d589fca1ac791de199938923099587a6 Mon Sep 17 00:00:00 2001 From: Horus Date: Thu, 15 Oct 2020 19:11:26 +0200 Subject: bugfix regarding copy by value != by reference --- index.html | 4 ++-- 1 file 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 ) { -- cgit v1.2.3