title: Javascript on node-red server
body: <p>I've written this to count all values in my array from msg.payload above 2.</p>
  
  <p>This code works, it returns the value from the first line which is 0 like the 2nd line is not running.</p>
  
  <p>Thanks for your help.</p>
  
  <pre><code>var count = 0;
  
  for(var i = 0; i &lt; msg.payload.length; ++i){
      if(msg.payload[i] &gt; 2)
          count++;
  }
  
  msg.payload = count
  return msg;
  </code></pre>