Tell us what’s happening:
Hello,
Can anyone help me on this ? I don’t know what I am doing wrong here
I am supposed to replace all special characters but can’t find the correct way:
With str.replace([^a-zA-Z0-9\s]) I was thinking
[a-z] ==> would check anything that is not lower case letter
[A-Z] ==> would check anything that is not Upper case letter
[0-9] ==> anything that is not a number
[\s] ==> anything that is not a whitespace
But I still get
“Your removeSpecialChars should not removes spaces”
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const removeSpecialChars = (str) => {
str.replace(/[^a-zA-Z0-9\s]/gi,"");
}
// 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/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Challenge Information:
Learn localStorage by Building a Todo App - Step 67