Learn localStorage by Building a Todo App - Step 67

Tell us what’s happening:

I’ve tried numerus of solution but nothing pass and the problem that when I tried in browser it work. pls help I stuck here since days. Here is my code Step 67

const removeSpecialChars = (val) => {
return val.trim().replace(/[^A-Za-z0-9-\s]/g,‘’)

};

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

const removeSpecialChars = (val) => {
  return val.trim().replace(/[^A-Za-z0-9\-\s]/g,'')
 
};


// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 67

1 Like

Welcome to the forum @Nahed

Here is a recent post you may find helpful.

Happy coding

I saw it but still have problem my code does not pass

Hi there!

Please post your updated code here in your next reply.

const removeSpecialChars = (val) => {
  const result= val.replaceِAll(/[^A-Za-z0-9\-\s]/g,'')
  
return result
};

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

your is not a valid character, you have an extra diacritic or something

const removeSpecialChars = (val) => {
  const result= val.replaceِAll(/[^A-Za-z0-9\-\s]/g,'')
return result
};

above is my code and still does not pass

your e is still not valid, you have a diacritic in there that is not valid in code

const removeSpecialChars = (val) => {
  const result= val.replaceAll(/[^A-Za-z0-9\-\s]/g,'')
return result

Your above code is passing on my end. Reset the challenge step, clear your browser cache, close browser extensions or change the browser and try again.

I don’t know what is happening. I’ve done everything but still dos not work. blow is my code

const removeSpecialChars = (val) => {
  const result= val.replaceAll(/[^A-Za-z0-9\-\s]/g,'')
return result

Which browsers did you try?

Hi @Nahed

Try closing the function with a curly brace.

Happy coding

Actually I’m using chrome.

I’ve already closed it but during copying I missed it.

have you tried all the steps listed here?

Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.

or - Try the step in incognito or private mode.

or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

or - Ensure your browser is up-to-date or try a different browser.

I hope one of these will work for you.

I’ve done all the check you mentioned but still does not pass.

can you share your code one last time?