# New line funktion node

**URL:** <https://discourse.nodered.org/t/new-line-funktion-node/63804>\
**Category:** General\
**Tags:** function-node\
**Created:** [11 June 2022 21:12 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804 "2022-06-11T21:12:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Higgis](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/higgis/32/26469_2.png) [@Higgis](https://discourse.nodered.org/u/Higgis)\
**Post date:** [11 June 2022 21:12 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804/1 "2022-06-11T21:12:51Z")

</div>

I am working on a function node where I as a payload combine a lot of variables, this becomes a single long text. I am now trying to find if you can write something between + to get a new line where I want it. Have tested and

....

 but nothing seems to work.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [11 June 2022 22:11 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804/2 "2022-06-11T22:11:24Z")

</div>

Not really clear what you are trying to achieve, can you post some examples?

If you are wanting more flexibility when working with strings in a function node though, you may want to look at [Template literals (Template strings) - JavaScript | MDN (mozilla.org)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).

These let you work with multiple lines and embedded JavaScript.

```auto
let a = 5;
let b = 10;
console.log(`Fifteen is ${a + b} and not ${2 * a + b}.`);

```

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [12 June 2022 09:52 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804/3 "2022-06-12T09:52:20Z")

</div>

Can you paste your 'single long text' (the complete full line) here in the forum, so we can see it's format.

---

<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:** [12 June 2022 09:56 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804/4 "2022-06-12T09:56:30Z")

</div>

> [@Higgis](#):
>
> I am now trying to find if you can write something between + to get a new line where I want it

Are you

- trying to insert a newline character into a string?
- Will this string be displayed in web (like dashboard)?

Or

- trying to break up the function code so that is is not a long single line?

Or

- asking how to join strings on multiple lines using `+` or `and` ?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [12 June 2022 11:25 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804/5 "2022-06-12T11:25:17Z")

</div>

From the way the question is described

> [@Higgis](#):
>
> trying to find if you can write something between + to get a new line where I want it

I'm guessing;

```auto
let a = 2
let b = 3
let c = 4
let d = 5
let e = 6
// instead of let total = a + b + c + (d*a) + e
// Use assignment operators to split calculation (+= *= /= -=)
let total = a
total += b+c
total += d*a
total *= e
// 114
msg.payload = total
return msg;

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 August 2022 11:25 UTC](https://discourse.nodered.org/t/new-line-funktion-node/63804/6 "2022-08-11T11:25:31Z")

</div>

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