Search and Replace challenge

Search and Replace challenge
0.0 0

#1

Tell us what’s happening:

dont know y its not working

Your code so far

function myReplace(str, before, after) {
 var arr=Array.from(arguments);
  if(arr[1].charAt(0)>=65 && arr1.charAt(0)<=90){
    str2=arr[2].split("");
    str2[0]=str2[0].toUpperCase();
    arr[2]=str2.join("");
  }
  return str.replace(arr[1],arr[2]);
}

myReplace("He is Sleeping on the couch", "Sleeping", "sitting");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36.

Link to the challenge:


#2

I didn’t checked the logic , anyway there’s a typo ( it seems ):
arr1.charAt(0)<=90) // arr[1]?