From b8b98a5972b72b9b986a953664385d39b003efe2 Mon Sep 17 00:00:00 2001 From: Jake Gerber Date: Sat, 24 Oct 2020 01:37:27 -0700 Subject: [PATCH] Added decimalIsolate file. --- Maths/decimalIsolate.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Maths/decimalIsolate.js diff --git a/Maths/decimalIsolate.js b/Maths/decimalIsolate.js new file mode 100644 index 000000000..30b164089 --- /dev/null +++ b/Maths/decimalIsolate.js @@ -0,0 +1,15 @@ +/* + * function isolates the decimal part of a number. + * Take the number and subtract it from the floored number. + * Return the result. + */ + +const decimalIsolate = (number) => { + return number - Math.floor(number) + +} + +// testing +console.log(decimal_isolate(35.345)) +console.log(decimal_isolate(56.879)) +console.log(decimal_isolate(89.5643))