Search and Replace------Why this doesnt work?

Tell us what’s happening:
Hi i dont know why my code doesnt work.

Your code so far


function myReplace(str, before, after) {
 let nevim = str.split(" ")
 let newArr = [];, i, arr) => {
    if(item === before) {
      if(item[0] === item[0].toUpperCase()) {
        newArr.push(after[0].toUpperCase() +  

let final = newArr.join(" ")
myReplace("Let us go to the store", "store", "mall");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.

Challenge: Search and Replace

Link to the challenge:

do you know what your function returns?
you need to have your function return something before knowing which tests pass

second point, your use of map is atrocious. please study on it and use it as intended (would even make your code simpler) or change method

1 Like

Thank you so much!!! I am an idiot…