JavaScript · Middle · Question 54 of 75
What does "a-b-c".replace("-", "+") return?
- ✓Correct answer:
"a+b-c" - 2
"a+b+c" - 3
"a-b-c"
Explanation
With a string pattern, replace changes only the first match. Use replaceAll("-", "+") or a regex with the g flag to replace all.