# Debug JS code inside function node

**URL:** <https://discourse.nodered.org/t/debug-js-code-inside-function-node/26925>\
**Category:** FAQs\
**Created:** [19 May 2020 13:20 UTC](https://discourse.nodered.org/t/debug-js-code-inside-function-node/26925 "2020-05-19T13:20:02Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2020 13:38 UTC](https://discourse.nodered.org/t/debug-js-code-inside-function-node/26925/5 "2020-05-19T13:38:37Z")

</div>

Here is it...

> [@How to proper debug custom node](https://discourse.nodered.org/t/how-to-proper-debug-custom-node/9308/13):
>
> This is how I debug a custom node in VS Code... It works for me however since this is a dist version of node-red its difficult sometimes to debug client side issues. Other than that, debug stop points work in my node js files. For debuging my .html files, i enter debugger into the function & open F12 (chrome debugger stops on the debugger statement) Setup... Install node-red as per instructions on [nodered.org](http://nodered.org) Run it one time so that .node-red folder is generated Install own node... cd c:…

And although the topic is about debuging a custom node - it works perfectly well for your requirement...

Just put `debugger` in your function node

e.g...

```javascript
var x = msg.payload;
debugger
//...some complex code
//...some complex code
//...some complex code
//...some complex code
return msg;

```

and if its all working, VSCode will pause on the debugger line.

---

_[View the full topic](https://discourse.nodered.org/t/debug-js-code-inside-function-node/26925)._
