I really don't know how is it possible, and I couldn't reproduce the error in a simplified environment, say JSFiddle. But here is how it looks in my application.
I'm trying to convert value that can be 'True', 'False' or 'something else' string into boolean if it is either True or False. In most cases it works just fine (although they may be a slicker way of doing the conversion) as it is shown on the picture below
however on occasion it fails and the value of the watch shows as follow:
So suddenly string variable with a value of "True" is not equal to a "True" string literal. I'm lost. How is it possible? What am I missing here?
Thanks in advance
Maybe your strings contain characters that your debugging tools don't show. Here's an example in Google Chrome's Console:
> var a = "foo";
> var b = "foo\r";
> a
"foo"
> b
"foo"
> a === b
false
It is really difficult to say what's going on in your case but you could work with the .length
and .charAt(i)
properties of the 'mysterious' strings to find out what's going on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With