Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
11
test/howManyTimes/howManyTimes.js
Normal file
11
test/howManyTimes/howManyTimes.js
Normal file
@ -0,0 +1,11 @@
|
||||
const howManyTimes = (num, divisor) => {
|
||||
if (divisor === 1 || divisor === -1) return Infinity;
|
||||
if (divisor === 0) return 0;
|
||||
let i = 0;
|
||||
while (Number.isInteger(num / divisor)) {
|
||||
i++;
|
||||
num = num / divisor;
|
||||
}
|
||||
return i;
|
||||
};
|
||||
module.exports = howManyTimes;
|
||||
Reference in New Issue
Block a user