We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
문자를 뒤집는 reverseString 함수를 추가합니다.
console.log(reverseString("hello")); // "olleh"
과도한 성능을 고려해서 복잡한 코드를 통해 가독성을 해치기보다, 가독성도 챙기며 동시에 유효하지 않은 유니코드 사용시 문제를 개선할 수 있는 spread - reverse - join 형태로 구현합니다.
유효하지 않은 유니코드
spread - reverse - join
참고로 split() + reverse()은 'foo 𝌆 bar' 와 같은 케이스에서 문제가 있습니다.
split() + reverse()
'foo 𝌆 bar'
('foo 𝌆 bar').split("").reverse().join(""); // rab �� oof // "𝌆" 가 사라졌습니다 😣
spread 연산자를 사용하면 의도대로 동작합니다
[...('foo 𝌆 bar')].reverse().join(""); // 'rab 𝌆 oof'
https://stackoverflow.com/questions/958908/how-do-you-reverse-a-string-in-place
The text was updated successfully, but these errors were encountered:
Sangminnn
Successfully merging a pull request may close this issue.
Package Scope
Overview
문자를 뒤집는 reverseString 함수를 추가합니다.
과도한 성능을 고려해서 복잡한 코드를 통해 가독성을 해치기보다, 가독성도 챙기며 동시에
유효하지 않은 유니코드
사용시 문제를 개선할 수 있는spread - reverse - join
형태로 구현합니다.참고로
split() + reverse()
은'foo 𝌆 bar'
와 같은 케이스에서 문제가 있습니다.spread 연산자를 사용하면 의도대로 동작합니다
Note
https://stackoverflow.com/questions/958908/how-do-you-reverse-a-string-in-place
The text was updated successfully, but these errors were encountered: