+ 1
I need help with replace() method
I need help to solve these 2 problems: 1. When I do string.replace("a","b") it only replaces the first occurrence of the letter I'm looking to replace 2. When replacing something like for example: var string = "Hello world" console.log(string.replace("hello", "hey") // Hello world it does not replace "Hello" because I am looking to replace "hello" but I want it to replace it even if it is "hEllO" what I write https://code.sololearn.com/cpJygrI36IBM/?ref=app
2 odpowiedzi
+ 2
console.log(string.toLowerCase().replace("hellO".toLowerCase(),"hey"))