Bitwise syntax error ("error in JavaScript code")

As we have said multiple times, that line should be
msg.zone = ((msg.payload[1 + 1] >> 2) & 1) == 1
if you want true/false, or
msg.zone = (msg.payload[1 + 1] >> 2) & 1
if you want 1/0

Urm, actually it can according to MDN which states that the bitwise operators convert their operands to 32bit integers. As I've previously stated several times now, that makes (0x01 == 0x01) === true === 1.

So that means that Monaco is being somewhat boorish here by showing an error when it should be showing a warning.

Non-the-less, again, as stated many times now, the original equation does not make sense and doesn't do what was intended.

Yeah that's what I meant Julian. I should probably have been more explicit.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.