Tell us what’s happening:
const removeSpecialChars = (str) => {
const regex = /[“”_‘’]/g
return str.replace(regex, “”);
}
So I just want to inform that with this code I also Pass the Tests and not every special Character is removed.
Maybe the test needs to be updated or is it a shortcut?
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const removeSpecialChars = (str) => {
const regex = /[""''_]/g
return str.replace(regex, "");
}
// 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
Challenge Information:
Learn localStorage by Building a Todo App - Step 67
ILM
January 29, 2025, 3:41pm
2
these are all the special characters that are tested, so it’s fine as it is. Maybe we will want to add more special characters to the tests
1 Like
Thank you for the fast reply. It is just that the special characters needed to remove are all in the task. It does not explicity say just those special Characters that is why I was confused.
In order to fix this, we need to create a function called removeSpecialChars
that takes a string as input and removes all special characters.
ILM
January 29, 2025, 5:47pm
4
yes, but I think it was tested with sentences, not with string with random symbols and letters. Would you like to create an issue for this?
No your are right. Was just confused. Thank you!
ILM
January 29, 2025, 6:37pm
6
an issue to test all the other symbols could totally be beneficials, it’s missing a lot of punctuation
1 Like