Cannot read property '0' of undefined

Dear nodered Experts,

I have this simple function that gets the value of msg.payload and loop through that value to get specific data, how ever I am having an error of "Cannot read property '0' of undefined.

I don't know how this happen. Anyone has already encountered this?
This is my function:

And this is the output of the debug node:

The second message is actually my data on which I like to loop on.

Thank you. I hope you can help me in here.

With kind regards,

tag is just the iterator - so you probably want
payload: tags[tag].value[0]

Hello Sir dceeyjay,

I never knew about this, it is now working !
Thank you very much!

WIth kind regards,

Yes this isn’t python :slight_smile:

Yeah! the struggle of using different languages :smiley:

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