Skip to content

Commit 693370b

Browse files
committed
String_reversal / 기초
1 parent 172c35e commit 693370b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tkddbs587/Stack/String_reversal.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function solution(str) {
2+
var answer = "";
3+
for (let i = str.length - 1; i >= 0; i--) {
4+
// 문자열 변수 str의 마지막 인덱스부터 한글자씩 접근
5+
answer += str[i]; // 문자열 변수 answer에 추가
6+
}
7+
return answer; // 뒤집은 문자열 반환
8+
}

0 commit comments

Comments
 (0)