📜
Replace All
Replace All쉬움 문자열 +10pts
Problem
Write a function that replaces all occurrences of a substring.
Examples
Input:
replaceAll("hello world", "o", "0")Output:
"hell0 w0rld"Explanation
이 문제는 **split()과 join()**을 조합하여 문자열의 모든 일치 항목을 바꾸는 방법을 학습합니다. ## 핵심 개념: 모두 바꾸기 패턴 모든 일치 항목을 바꾸는 방법은 여러 가지가 있습니다. ### 방법 1: split + join (권장) ```javascript str.split(search).join(replace) ``` - split으로 문자열을 배열로 분리 - join으로 다른 문자로 연결 ### 방법 2: replaceAll (ES2021+) ```javascript str.replaceAll(sear...
View detailed explanation →Key Concepts
split 메서드 join 메서드 replaceAll 문자열 치환
Time: O(n) Space: O(n)
solution.js
Ctrl + Enter
Run tests to see results here.