Skip to content

Commit 01450c3

Browse files
committed
Multiple number / 중급
1 parent d35d6ff commit 01450c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function solution(arr, divisor) {
2+
var answer = [];
3+
4+
arr.forEach((el) => {
5+
if(el % divisor === 0) answer.push(el);
6+
})
7+
answer.sort((a,b) => a-b);
8+
9+
if(answer.length === 0) return [-1];
10+
11+
return answer;
12+
}

0 commit comments

Comments
 (0)