-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathcheckFactor.js
More file actions
22 lines (15 loc) · 626 Bytes
/
checkFactor.js
File metadata and controls
22 lines (15 loc) · 626 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
This function should test if the factor is a factor of base.
Return true if it is a factor or false if it is not.
About factors
Factors are numbers you can multiply together to get another number.
2 and 3 are factors of 6 because: 2 * 3 = 6
You can find a factor by dividing numbers. If the remainder is 0 then the number is a factor.
You can use the mod operator (%) in most languages to check for a remainder
For example 2 is not a factor of 7 because: 7 % 2 = 1
Note: base is a non-negative number, factor is a positive number.
*/
//Answer//
function checkForFactor (base, factor) {
return base % factor === 0;
}