Javascript if having AND for two comparisons returns true even if other comparison is false -


this copy-paste firebug watch window:

mmapdevices[i].ishighlighted true
mmapdevices[i].device.nodetypecode "m"
mmapdevices[i].device.nodetypecode !== "m" false
mmapdevices[i].nodetypecode !== "m" && mmapdevices[i].ishighlighted true
true && false false
typeof(mmapdevices[i].device.nodetypecode) "string"
typeof("m") "string"

when running script execution goes inside if clause:

if (mmapdevices[i].ishighlighted && mmapdevices[i].nodetypecode !== "m") { 

what happening here?

this line problem:

mmapdevices[i].nodetypecode !== "m" && mmapdevices[i].ishighlighted

should be:

mmapdevices[i].device.nodetypecode !== "m" && mmapdevices[i].ishighlighted


Comments