有人可以用if语句帮助我吗?(Can someone help me with an if statement? The result is true, but the event will not fire)

我正在检索在控制台中显示值为true的数据,但是当我设置if语句时

if (onLive == true) { alert ("is working") }

警报不会触发。 谁能帮我? 这是代码http://jsfiddle.net/8j947/

I am retrieving data that displays a value of true in the console, but when I set up an if statement

if (onLive == true) { alert ("is working") }

the alert does not fire. Can anyone help me? Here is the code http://jsfiddle.net/8j947/

最满意答案

isLive是"true" (包含单词true的字符串),而不是true (布尔值)。

isLive is "true" (a string containing the word true), not true (a boolean value).

更多推荐