Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 Javascript 中的 equal 语句有疑问。看这个截图:
我正在尝试检查索引是否与“删除”相同,但这绝不是真的。如果我尝试index === "Delete"or也不是真的index == "Delete"。
index === "Delete"
index == "Delete"
index是一个对象,它似乎没有toString()方法。因此,调用toString()它很可能会导致[object Object],这显然不是你想要的。
index
toString()
[object Object]
试试if( index.return === "Delete")吧。
if( index.return === "Delete")