diff options
| author | Horus | 2020-10-15 19:11:26 +0200 |
|---|---|---|
| committer | Horus | 2020-10-15 19:11:26 +0200 |
| commit | bdc6a8e7d589fca1ac791de199938923099587a6 (patch) | |
| tree | 87b8e5a738519b5ba9f0a5fce0430121c948c628 | |
| parent | fe36e85bd72a082626704acee5cbdfdbefbbdaef (diff) | |
| download | bpm -bdc6a8e7d589fca1ac791de199938923099587a6.tar.gz | |
bugfix regarding copy by value != by reference
| -rw-r--r-- | index.html | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 ) { |
