我有2个相等的字符串,当我做一个console.log()知道它们是否相等时,我会这样做:
console.log("message = " + document.getElementsByClassName("hud-chat-message")[i].childNodes[0].innerHTML + " type = " + typeof document.getElementsByClassName("hud-chat-message")[i].childNodes[0].innerHTML)
console.log("chatbotname = " + Ultimate.bots[name].chatBotName + " type = " + typeof Ultimate.bots[name].chatBotName)
console.log(document.getElementsByClassName("hud-chat-message")[i].childNodes[0].innerHTML == Ultimate.bots[name].chatBotName)
然后说:
message = <strong>Leaderboard on Discord</strong><small> (leaderboard!)</small><span class="botTagRegular botTag bot">BOT</span> type = string
VM3681:229 chatbotname = <strong>Leaderboard on Discord</strong><small> (leaderboard!)</small><span class='botTagRegular botTag bot'>BOT</span> type = string
VM3681:230 false
两个字符串是相同的类型,是平等的,但是它说false
,它不等...为什么?怎么了?谢谢
字符串<span class="botTagRegular botTag bot">
不等于<span class='botTagRegular botTag bot'>
,因为'
和"
是不同的符号