Hello, I think you missed something here. I tried your code and the output is : "Goodbye, Goodbye there!". By the way, thanks for sharing! This materials is easier to learn.
let str = "Hello, hi there!";
str = str.replace(/[Hh]ello|[Hh]i|[Hh]ey/g, "Goodbye");
console.log(str); // Will output "Goodbye, hi there"
I run my own programming blog called Unicorn Utterances, I do development of all kinds, usually focusing on web development.
I collect retro video games 🎮, like reading 📖, love teaching 👨🏫
Hello, I think you missed something here. I tried your code and the output is : "Goodbye, Goodbye there!". By the way, thanks for sharing! This materials is easier to learn.
let str = "Hello, hi there!";
str = str.replace(/[Hh]ello|[Hh]i|[Hh]ey/g, "Goodbye");
console.log(str); // Will output "Goodbye, hi there"
Whoops! Yup, it should be "Goodbye, Goodbye there!" for sure. I'll update that.
Thanks for reading and letting me know!
No problem! it was a good read. Thanks too!