Intermediate Algorithm Scripting - Search and Replace

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

function myReplace(str,before,after) {
 if (before.match(/^[A-Z]/))
}else {

  return str.replace(before,after);


console.log(myReplace("i think we should look up there","up","Down"));

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 9; Infinix X652) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Mobile Safari/537.36

Challenge: Intermediate Algorithm Scripting - Search and Replace

Link to the challenge:

You might do a console log of after right before you return. If that doesn’t give you enough of a hint as to why it isn’t working let us know.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.