From f0d8ca0b8c4be869696b69a811e6ff87f46f5e93 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 16 Apr 2020 10:57:47 +0300 Subject: [PATCH] Remove heronArea --- snippets_archive/heronArea.md | 21 --------------------- test/heronArea.test.js | 8 -------- 2 files changed, 29 deletions(-) delete mode 100644 snippets_archive/heronArea.md delete mode 100644 test/heronArea.test.js diff --git a/snippets_archive/heronArea.md b/snippets_archive/heronArea.md deleted file mode 100644 index 1be742986..000000000 --- a/snippets_archive/heronArea.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: heronArea -tags: math,beginner ---- - -Returns the area of a triangle using only the 3 side lengths, Heron's formula. Assumes that the sides define a valid triangle. Does NOT assume it is a right triangle. - -More information on what Heron's formula is and why it works available here: https://en.wikipedia.org/wiki/Heron%27s_formula. - -Uses `Math.sqrt()` to find the square root of a value. - -```js -const heronArea = (side_a, side_b, side_c) => { - const p = (side_a + side_b + side_c) / 2 - return Math.sqrt(p * (p-side_a) * (p-side_b) * (p-side_c)) - }; -``` - -```js -heronArea(3, 4, 5); // 6 -``` \ No newline at end of file diff --git a/test/heronArea.test.js b/test/heronArea.test.js deleted file mode 100644 index 70c0173c2..000000000 --- a/test/heronArea.test.js +++ /dev/null @@ -1,8 +0,0 @@ -const {heronArea} = require('./_30s.js'); - -test('heronArea is a Function', () => { - expect(heronArea).toBeInstanceOf(Function); -}); -test('howManyTimes returns the correct result', () => { - expect(heronArea(3, 4, 5)).toBe(6); -});