Logical operator with three variables

Hi, somehow I have an error that I can not find. I have three variables. Only when all three variables are "1", the output should be "1".
The problem is that after deploy, every first time a variable is "1", the output becomes "1". If all variables are a "1" the node works correctly. Do you have a hint what I am doing wrong?

the function node:

var x = flow.get("dashboard");
var y = flow.get("start");
var z = flow.get("telegram");
if (x == 1 & y == 1 & z == 1) {
msg.payload = 1;
}
else {
msg.payload = 0;
}
return msg;

This must be:

if (x == 1 && y == 1 && z == 1) {

https://www.w3schools.com/jsref/jsref_operators.asp

1 Like

Thanks a lot!

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