链接双等于==返回false [英] chaining double equals == returns false
本文介绍了链接双等于==返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个文本框,我试图对所有3个值都匹配进行验证.我有一个简单的功能:
函数DidSubsriberSignatureMatch(){返回tbNameOfSubscriber.GetText()== tbSubscriberSig1.GetText()== tbSubscriberReEnter.GetText();}
我逐步调试了调试器,并且看来至少在Chrome的Javascript中,"a" =="a"返回true,但是"a" =="a" =="a"返回false.>
为什么?
解决方案
也许来自Python?大多数语言实际上没有比较链.尝试它会产生废话.
I have 3 textboxes that I am trying to do some validation that all 3 values match. I have a simple function:
function DoesSubsriberSignatureMatch() {
return tbNameOfSubscriber.GetText() == tbSubscriberSig1.GetText() == tbSubscriberReEnter.GetText();
}
I stepped through with the debugger, and it seems in Javascript in Chrome at least, "a"=="a" returns true, but "a"=="a"=="a" returns false.
Why?
解决方案
Coming from Python, perhaps? Most languages don't actually have comparison chaining. Trying it produces nonsense results.
这篇关于链接双等于==返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文