Search and replace test

**Tell us what's happening:**
Describe your issue in detail here.
Hi guys please why exactly are my not passing this challenge

      **Your code so far**
      
```js

function myReplace(str, before, after) {
 if (before[0] === before[0].toUpperCase()) {
  after = after.replace(after[0], after[0].toUpperCase());
}
return str.replace(before, after);
}


console.log(myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped"));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0

Challenge: Search and Replace

Link to the challenge:

Try this

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

Can you see where the problem is?

You gotta do the same for the lowercase condition

what do you mean by do the same for the lowerCase condition??

You are checking for uppercase in the before parameter. But you also need to make sure that if your function gets passed a word with an uppercase letter in the after parameter that it will change it to lowercase if it needs to.

1 Like

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