Tell us what’s happening:
Describe your issue in detail here.
I don t get why it doesn t pass when i try all the tests it works but when i press space + enter it gives me errors and only 2 of the tests passes
Your code so far
function myReplace(str, before, after) {
let some = str.split(" ");
for(let i = 0; some.length > i; i++) {
if (some[i] === before) {
some[i] = after;
}
}
return some.join(" ");
}
console.log(myReplace("I think we should look up there", "up", "Down"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 OPR/99.0.0.0
Challenge: Intermediate Algorithm Scripting - Search and Replace
Link to the challenge: