JavaScript · Middle · Question 54 of 75

What does "a-b-c".replace("-", "+") return?

Explanation

With a string pattern, replace changes only the first match. Use replaceAll("-", "+") or a regex with the g flag to replace all.

Further reading

Problem with a question

JavaScript · Middle · question 54

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz