1

I'm trying to compare the string "Anyone" to an object value that is also supposed to be "Anyone" and looks equal when logging to the console.

I'm checking the 2 strings using:

for char, index in text
    console.log "char " + index + ": " + text.charCodeAt(index)

One string returns one extra character with the code 8291. What character is this and how can I remove it? .trim() and using a regex whitespace remover doesn't seem to work.

NeedsHelp
  • 427
  • 1
  • 7
  • 24

1 Answers1

2

Solved using str.replace(/[^\x00-\x7F]/g, "");. Which removes all non-ascii characters.

NeedsHelp
  • 427
  • 1
  • 7
  • 24