From 008162228e59c731a1cbcd5d0bcaf33f34a0df74 Mon Sep 17 00:00:00 2001 From: Jake Gerber Date: Sat, 10 Oct 2020 14:02:35 -0700 Subject: [PATCH] Add and fixed isOdd.js --- Maths/isOdd.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Maths/isOdd.js b/Maths/isOdd.js index 22acc8deb..7263ceafe 100644 --- a/Maths/isOdd.js +++ b/Maths/isOdd.js @@ -1,21 +1,17 @@ -//Returns true if a number is odd, returns false if a number is even, and returns null if the number is a decimal. +// Returns true if a number is odd, returns false if a number is even, and returns null if the number is a decimal. function isOdd (num) { - - if (num < 0) - { + if (num < 0) { num *= -1 } - if (Math.floor(num) !== num) - { + if (Math.floor(num) !== num) { console.error('Decimal Value') return null } - if (num % 2 === 1) - { + if (num % 2 === 1) { return true } - return false -} \ No newline at end of file + return false +}