Skip to content

Commit cf37c8c

Browse files
committed
Use the ** operator instead of Math.pow
1 parent 17cd6ee commit cf37c8c

File tree

1 file changed

+2
-2
lines changed
  • examples/javascript/PitchDetection/PitchDetection_Game

1 file changed

+2
-2
lines changed

examples/javascript/PitchDetection/PitchDetection_Game/sketch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function draw() {
112112
}
113113

114114
function dist(x1, y1, x2, y2) {
115-
return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
115+
return Math.sqrt(((x2 - x1) ** 2) + ((y2 - y1) ** 2));
116116
}
117117

118118
function gameReset() {
@@ -152,4 +152,4 @@ function createCanvas(w, h) {
152152
canvas.fillStyle = '#ebedef'
153153
canvas.fillRect(0, 0, w, h);
154154
return canvas;
155-
}
155+
}

0 commit comments

Comments
 (0)