Strings are equal, but different? Weird string-to-string comparison behaviour

Hi @ulrich,

Thanks for your detailed response!

Indeed, your assumptions are correct. The problem I was facing was the following:
var p = ${N_priceRaw2}; p2= p.replace(" ", “”); return p2;

The string p2 was coming out with no spaces removed, causing the parseInt/parseFloat to only parse the first digit. Your p.replace(/\s/g, ‘’) actually solved the problem, though I’m unsure why your version worked while mine didn’t. Why are the spaces not equal?

Edit: It looks like the test webpage reached its limit, if anyone wants the original HTML here it is:
https://pastebin.com/8mATNgLK

1 Like