Generate messages with for Loops

Hi Forum,

my msg.payload has an array and i want to run a for-loop times the size of the array length. Every time the loop ends the function should return a message. Is that possible?

I tried the following but this is not working, of course

for (let i = 0 ; i<msg.payload.length; i++){
    return msg;

Yes it is possible, but rather than calling 'return' which exits the current function, you would use node.send(msg).


Thank you so much!

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