We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a496e6 commit 00e2417Copy full SHA for 00e2417
IsDivisibleByXandY.js
@@ -0,0 +1,24 @@
1
+/**
2
+ * Checking to see if a number n is divisible by x and y.
3
+ */
4
+
5
6
7
+const isDivisible = (n, x, y) => {
8
9
+ const firstResult = n / x
10
+ const nextResult = n / y
11
12
+ if(firstResult % 1 === 0 && nextResult % 1 === 0) {
13
+ return true
14
+ }
15
+ else {
16
+ return false
17
18
+}
19
20
+// prints true
21
+console.log(isDivisible(8, 2, 2))
22
23
+// also:
24
+// return (n % x === 0 && n % y === 0) ? true : false
0 commit comments