Hey can anyone help me create the code below I am currently stuck and would like to understand how to create the code below.
Create a function called removeSpecialChars that takes a string as input and removes all special characters.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const removeSpecialChars = '';
// User Editable Region
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 OPR/114.0.0.0
Challenge Information:
Learn localStorage by Building a Todo App - Step 67
Hey Hasan this is what I came up with but I don’t know which part I am messing up at. Can you help me identify which part I am getting wrong.
functionremoveSpecialChars(localStorage) {
returnlocalStorage.replace(/A-Za-z0-9/, " ");
}
First thing is that, the keywords of your function mixed up all together, as I can see it in your reply. It should be indented properly, if it’s look also same in your challenge editor. To show your code here properly, use three back ticks on a separate line before and after your code block. You can use </> preformatted text option in the reply settings to insert back ticks automatically.
Second thing is that, your regex is not correct. Correct your regex pattern. You need to do it yourself, I can’t give you the pattern, because it’s a solution to the challenge step. Posting solution code is not allowed here.