Trying to get the modulo operator to work in javascript. This is for a NodeRed function that takes in values in a array. I can get the avg value out without the modulo operator, with it nothing happens. Can anyone help? The point of this is to get the avg angles correct considering 0-360 degrees
value1 = {};
value2 = {};
value3 = {};
value4 = {};
value5 = {};
avg = {};
msg.number = msg.payload;
value1.payload=msg.number[1];
value2.payload=msg.number[2];
value3.payload=msg.number[3];
value4.payload=msg.number[4];
avg.payload = (((msg.number[1]+msg.number[2]+msg.number[3]+msg.number[4])/4)%360);
return avg;
**%360**What is this expected to do? You may get more insight as to what's breaking if you look at the console.%360there for emphasis or is it the actual code? Also, please give examples of the input data: msg.number[1] is actually a number? what's the value range?