์ ์ ๋ฐฐ์ด numbers๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง๋๋ค. numbers์ ๊ฐ ์์์ ๋๋ฐฐํ ์์๋ฅผ ๊ฐ์ง ๋ฐฐ์ด์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์.
numbers | result |
---|---|
[1, 2, 3, 4, 5] | [2, 4, 6, 8, 10] |
[1, 2, 100, -99, 1, 2, 3] | [2, 4, 200, -198, 2, 4, 6] |
์ ์ถ๋ ฅ ์ #1
์ ์ถ๋ ฅ ์ #2
function solution(numbers) {
let sum = [];
for(let i = 0; i<numbers.length; i++) {
sum.push(numbers[i] * 2)
}
return sum;
}