> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/build/code.md).

# Write a short step with Code in Duaer

In Duaer, Code runs JavaScript or Python on the current items. Prefer Edit Fields when you only change a few fields.
## Write it, then Execute step

1. Search for Code and connect it after the previous node.
2. Set Mode to Run Once for All Items, or Run Once for Each Item.
3. Set Language to JavaScript or Python.
4. Write the code. In JavaScript, $input.all() and $json are the usual ways to read items.
5. Select Execute step and check the output.

When you only reshape a few fields, Edit Fields is enough. Refer to [Change fields with Edit Fields in Duaer](/build/edit-fields.md).

When Code must point back at an earlier item, you sometimes set pairedItem yourself. Refer to [Preserve linking in Duaer’s Code node](/data/data-mapping/data-item-linking/item-linking-code-node.md).
## Questions

### Does Code in Duaer run once for the whole batch by default?

Yes. The default is Run Once for All Items. Choose Run Once for Each Item when each item needs its own run.

