n8n-docs/docs/code/cookbook/code-node/console-log.md

33 lines
1.0 KiB
Markdown

---
description: How to use console.log() or print()
contentType: howto
---
# Using console.log or print in the Code node
You can use `console.log()` or `print()` in the Code node to help when writing and debugging your code.
For help opening your browser console, refer to [this guide by Balsamiq](https://balsamiq.com/support/faqs/browserconsole/){:target=_blank .external-link}.
## console.log (JavaScript)
For technical information on `console.log()`, refer to the [MDN developer docs](https://developer.mozilla.org/en-US/docs/Web/API/Console/log){:target=_blank .external-link}.
For example, copy the following code into a Code node, then open your console and run the node:
```js
let a = "apple";
console.log(a);
```
## print (Python)
For technical information on `print()`, refer to the [Real Python's guide](https://realpython.com/python-print/){:target=_blank .external-link}.
For example, set your Code node **Language** to **Python**, copy the following code into the node, then open your console and run the node:
```python
a = "apple"
print(a)
```