The filter() method expect to receive true or false from the callback and keep the values for which it was true and remove the values for which it was false, you can’t use it to change the values in an array - but you can use map() to change the values in an array
I’ve edited your post 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 easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.