Convert HTML Entities code doesn't work

My answer from another thread with the same issue:

However, I’d also recommend you look at simplifying and optimizing your code. str.split('') gives an array where each element is a string of length = 1, yet you’re using the replace method, which is useful for changing a substring of an existing string. When your string is only 1 character long, any substring is either the full string or is empty.

1 Like