Reputation: 3793
While debugging I noticed something weird:
the result var is shown as null, both in mouse hover and in the watch, but the right hand side is actually returning non-null value as you can see in the watch.
Any ideas why?
EDIT: the result variable is also declared in the IF statement, something like this:
if (somethingIsTrue) { var result = xxx; }
else { var result = yyy; }
As soon as I renamed the second result to something else, all started showing correctly.
Upvotes: 0
Views: 120
Reputation: 39338
When your code is like this
if (somethingIsTrue) { var result = xxx; } else { var result = yyy; }
Then that 'result' variable is (re)declared within the scope of that if-statement. That means the value is only available within that block.
Solution: declare the variable outside of the block (if you haven't done that already) and remove the 'var's inside the 'if' and 'else' blocks
Upvotes: 2