From c16634f85ee1ac99b6632b6be82e4681362e8e1f Mon Sep 17 00:00:00 2001 From: Guilherme Siquinelli Date: Sat, 3 Feb 2024 03:53:09 -0300 Subject: [PATCH] fix: fixes code in example 1 the example code does not work, it is necessary to remove the backticks (template strings) --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index afc0173..beace18 100644 --- a/index.html +++ b/index.html @@ -106,8 +106,8 @@

Introduction

function piStep() { var r = 10; - var x = Math.random() `*` r `*` 2 - r; - var y = Math.random() `*` r `*` 2 - r; + var x = Math.random() * r * 2 - r; + var y = Math.random() * r * 2 - r; return (Math.pow(x, 2) + Math.pow(y, 2) < Math.pow(r, 2)) } function refinePi(deadline) { @@ -116,7 +116,7 @@

Introduction

pointsInside++; pointsTotal++; } - currentEstimate = (4 `*` pointsInside / pointsTotal); + currentEstimate = (4 * pointsInside / pointsTotal); textElement = document.getElementById("piEstimate"); textElement.innerHTML="Pi Estimate: " + currentEstimate; requestId = window.requestIdleCallback(refinePi); @@ -540,7 +540,7 @@

Acknowledgments

this specification: Sami Kyostila, Alex Clarke, Boris Zbarsky, Marcos Caceres, Jonas Sicking, Robert O'Callahan, David Baron, Todd Reifsteck, Tobin Titus, Elliott Sprehn, Tetsuharu OHZEKI, Lon Ingram, Domenic Denicola, - Philippe Le Hegaret and Anne van Kesteren.

+ Philippe Le Hegaret, Anne van Kesteren and Guilherme Siquinelli.