Is there support for reduce functions in n8n Code node?

Is there support for reduce functions in the Code node of n8n ? I am getting this error when attempting to rune this code leveraging the said function : ERROR: res is not defined

What is the error message (if any)?

ERROR: res is not defined

Please share your workflow

Share the output returned by the last node

N\A

Information on your n8n setup

  • **n8n version:1.26.0
  • **Database (default: SQLite):default
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):own
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):docker
  • **Operating system:Docker Composer

Hi @cmorneau, the error you are seeing is not related to the .reduce() method (which to answer your question can be used in the Code node), but because you are referencing a res object which does not exist.

Perhaps you want to try something like below instead?

This returns the following response:

2 Likes

My mistake, thank you! Happy to see this function is fully supported.

1 Like

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