Skip to content

Commit 701ebda

Browse files
committed
22/03/23
1 parent b679b55 commit 701ebda

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function countDigit(num) {
2+
const numArray = num.toString().split("");
3+
let count = 0;
4+
for (let i = 0; i < numArray.length; i++) {
5+
if (num % parseInt(numArray[i]) === 0) {
6+
count++;
7+
}
8+
}
9+
return count;
10+
}
11+
12+
console.log(countDigit(1248));

0 commit comments

Comments
 (0)