Skip to content

Commit 05699a2

Browse files
committed
Updating proof solution
1 parent 7607915 commit 05699a2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export const reverseString = (string) => {
22
let revString = '';
3-
for (let i = string.length - 1; i >= 0; i -= 1) {
4-
revString += string[i];
3+
let characters = Array.from(new Intl.Segmenter().segment(String(string)), (x) => x.segment);
4+
for (let i = characters.length - 1; i >= 0; i--) {
5+
revString += characters[i];
56
}
67
return revString;
78
};

0 commit comments

Comments
 (0)