Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 03fe138

Browse files
chaerin-devprove-ability
authored andcommitted
Add 나누어-떨어지는-숫자-배열.js
1 parent 1102c9d commit 03fe138

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎level-1/나누어-떨어지는-숫자-배열.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ function solution(arr, divisor) {
1717
answer.length === 0 ? answer.push(-1) : null
1818
answer.sort((a, b) => a - b)
1919
return answer;
20+
}
21+
22+
//정답 3. chaerin-dev
23+
function solution(arr, divisor) {
24+
let answer = [];
25+
arr.forEach((e) => {
26+
if (e % divisor === 0) answer.push(e);
27+
});
28+
return answer.length ? answer.sort((a, b) => a - b) : [-1];
2029
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /