Tell us what’s happening:
guys you can see whats happening why is it not running correctly??
please help!!
Your code so far
function myReplace(str, before, after) {
str=str.split(" ");
for(var i=0;i<str.length;i++){
if(str[i]==before){
str[i]=after;
}
}
return str.join(" ");
}
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_7_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
.
Link to the challenge: