For this step i have added the g flag to my regex value but it keeps on saying you should add the g flag to your regex value. I have reset it but it is still not working pls may i get help as i am confused why it says you should add the g flag to your regex value when I have.
Your code so far
/* file: script.js */
function cleanInputString(str) {
const regex = /[-\s]+/g;
return str.replace(regex, '');
}
let input = "This - is a test - string";
let cleaned = cleanInputString(input);
console.log(cleaned);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
Learn Form Validation by Building a Calorie Counter - Step 23