https://programmers.co.kr/learn/courses/30/lessons/12910
function solution(arr, divisor) {
var answer = [];
var lenArr = arr.length;
for (var i=0; i<lenArr; i++){
if((arr[i] % divisor) === 0){
answer.push(arr[i]);
}
}
answer.sort((a,b) =>a-b);
if(answer.length === 0){
answer = [-1];
}
return answer;
}
function solution(arr, divisor) {
var answer = [];
for(var i=0; i<arr.length; i++){
if(arr[i] % divisor === 0 ){
answer[answer.length] = arr[i];
}
}
if (answer.length === 0){
answer[0] = -1;
}
answer = answer.sort((number1, number2) => number1 - number2);
return answer;
}
//divisor의 배수만 남기기
//배열에 어떻게 집어넣지?
//오름차순정렬 - sort 쓸때랑 sort안쓸때로 구분
#배수, 정렬