# Is the javascript code example valid?

**URL:** <https://community.n8n.io/t/is-the-javascript-code-example-valid/18856>\
**Category:** Feedback\
**Tags:** core, node\
**Created:** [October 19, 2022, 7:01pm UTC](https://community.n8n.io/t/is-the-javascript-code-example-valid/18856 "2022-10-19T19:01:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian-Samuel](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/adrian-samuel/32/3251_2.png) [@Adrian-Samuel](https://community.n8n.io/u/Adrian-Samuel)\
**Post date:** [October 19, 2022, 7:01pm UTC](https://community.n8n.io/t/is-the-javascript-code-example-valid/18856/1 "2022-10-19T19:01:39Z")

</div>

This [page](https://docs.n8n.io/code-examples/methods-variables-examples/node/) talks about the use of `$("<node-name>").item` using a javascript code snippet to show functionality.

The caveat according to this same page is, however:

> Not avaialble in Function node  
> (typo in the word “available btw”)  
> and below says:  
> $(“”).item isn’t available in the Function node.

Isn’t this a bit misleading? Since you can only write JS code in this format in a function node? If it can’t be written in this format, then maybe another should be supplied like `{{$node["node-name].parameters}}`

Also, when using this object in another node, it looks like the `item` object isn’t accessible, and the parameters/binary/json object can be accessed on the top level rather than being nested under `item`.

Have I missed something?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [October 20, 2022, 6:09am UTC](https://community.n8n.io/t/is-the-javascript-code-example-valid/18856/2 "2022-10-20T06:09:44Z")

</div>

Hi @Adrian-Samuel, the Function node has been replaced with a “Code” node in recent versions of n8n. Perhaps you can try upgrading your n8n version? Afterwards you should be able to use this snippet.

Once upgraded, this expression should also work in other nodes, I just tested this in the Set node:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/9/7/970eeb12de1b0508f5bd6acedb3661e112789e99.png)

Hope this helps! Let me know if you run into any trouble with this.
