Β
Β
νμ΄λ³΄κΈ°
λ¨Όμ λ°°μ΄μ Math.min λ©μλμ μ€νλ λ μ°μ°μλ‘ λ겨μ μ΅μκ°μ ꡬν΄λλ€.
λ°°μ΄ λ΄ μ΅μκ°μ λ§λ λλ§λ€ resultμ λ΄μμ€λ€.
Β
function answer(nums) {
let result = [];
let min = Math.min(...nums);
console.log(nums.forEach((v, i) => v === min && result.push(i)));
return result;
}