From a4675c1e8683d52ba1c5375a73ae2bfec1d8c831 Mon Sep 17 00:00:00 2001 From: Darren Scerri Date: Tue, 12 Dec 2017 09:45:19 +0100 Subject: [PATCH] Fix syntax error --- README.md | 2 +- snippets/distance-between-two-points.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b166f0f6..cb3cad760 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ var difference = (arr, values) => Use `Math.pow()` and `Math.sqrt()` to calculate the Euclidean distance between two points. ```js -var distance = x0, y0, x1, y1 => +var distance = (x0, y0, x1, y1) => Math.sqrt(Math.pow(x1-x0, 2) + Math.pow(y1 - y0, 2)) ``` diff --git a/snippets/distance-between-two-points.md b/snippets/distance-between-two-points.md index e8c91eafd..f6e4eb74c 100644 --- a/snippets/distance-between-two-points.md +++ b/snippets/distance-between-two-points.md @@ -3,6 +3,6 @@ Use `Math.pow()` and `Math.sqrt()` to calculate the Euclidean distance between two points. ```js -var distance = x0, y0, x1, y1 => +var distance = (x0, y0, x1, y1) => Math.sqrt(Math.pow(x1-x0, 2) + Math.pow(y1 - y0, 2)) ```