Skip to content

Commit c942abf

Browse files
committed
배열 자르기, 기초
1 parent ecbe1b2 commit c942abf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

unn04012/array/cut_array.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function solution(numbers, num1, num2) {
2+
const answer = [];
3+
4+
for (let i = num1; i <= num2; i++) answer.push(numbers[i]);
5+
6+
return answer;
7+
}
8+
9+
console.log(solution([1, 2, 3, 4, 5], 1, 3));

0 commit comments

Comments
 (0)