# Node.warn( ) help

**URL:** <https://discourse.nodered.org/t/node-warn-help/3300>\
**Category:** General\
**Created:** [20 September 2018 09:13 UTC](https://discourse.nodered.org/t/node-warn-help/3300 "2018-09-20T09:13:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 September 2018 09:13 UTC](https://discourse.nodered.org/t/node-warn-help/3300/1 "2018-09-20T09:13:06Z")

</div>

Ok,

```auto
node.warn("message" + variable_name);

```

A line of text in the debug window to the right.  
Not wanting to be difficult, but can I send multiple lines of text from one message?

Say I want to send: (Literally)

* * *

\*\* information as requested \*\*

* * *

with ONE node.warn( ) line.

Can it be done?

Just I am finding that with NR's async' operation sometimes consecutive node.warn( ) messages are not.

Just asking.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 September 2018 09:51 UTC](https://discourse.nodered.org/t/node-warn-help/3300/2 "2018-09-20T09:51:20Z")

</div>

I always start my node.warn's with an identifier so the first would be:  
`node.warn("DBG01: message" + variable_name);`  
and the second:  
`node.warn("DBG02: message" + variable_name);`  
however if you want something like:

```auto
=============
dbg01 testing
=============

```

then add a '\n' where you want the breaks like this:

```auto
var dbg = '=============\n';
dbg = dbg + 'dbg01 testing\n';
dbg =dbg + '=============\n';

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 September 2018 10:04 UTC](https://discourse.nodered.org/t/node-warn-help/3300/3 "2018-09-20T10:04:46Z")

</div>

Thanks.

Sorry it was a bad example.

I didn't know the line of \*'s would be ....... changed.

So trying to get my head around what you said:  
I want:  
(This time I'll use a different symbol)

xxxxxxxxxxxxxxxxxxxxxxxx  
xx TITLE : (var name)  
xxxxxxxxxxxxxxxxxxxxxxxx

I'm reading it to be written as:

```auto
var y = 'xxxxxxxxxxxxxxxxxxxx\n';
var x = y + " Title : " + variable name\n;
x = y;

```

I tried a bit of "sneaky stuff" there to save repeating putting in the line of x's.

Am I getting the hang of it?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 September 2018 10:05 UTC](https://discourse.nodered.org/t/node-warn-help/3300/4 "2018-09-20T10:05:56Z")

</div>

So what is the result if you try that?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 September 2018 10:07 UTC](https://discourse.nodered.org/t/node-warn-help/3300/5 "2018-09-20T10:07:24Z")

</div>

I am just now sitting down with a text editor going through the flows trying to reconsile (?) what is the problem with the flows which are working on one machine and not on another.

I'll try it shortly.

Unexpected symbol line 3 at the \n at the end of the variable\_name\n; part.

```auto
var variable_name = "test";
var y = 'xxxxxxxxxxxxxxxxxxxx\n';
var x = y + " Title : " + variable_name\n;
x = y;
return msg;

```

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [20 September 2018 10:22 UTC](https://discourse.nodered.org/t/node-warn-help/3300/6 "2018-09-20T10:22:32Z")

</div>

In line 3, the \n should be added onto the end of the line surrounded by quote marks

In line 4, your resetting x back to the value of y - so line 3 will have no effect

In line 5, you are returning the msg but since you haven't altered the msg.payload so it will just return the original msg

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 September 2018 10:33 UTC](https://discourse.nodered.org/t/node-warn-help/3300/7 "2018-09-20T10:33:41Z")

</div>

I also forgot to declare it was a node.warn( ) that I was doing.

This is the code I "resolved" from the first reply:

```auto
var variable_name = "test";
var y = 'xxxxxxxxxxxxxxxxxxxx\n';
var x = y + " Title : " + variable_name+'\n';
x = x + y;
node.warn(x);
return msg;

```

Forgetting the message and just looking at the node.warn( ) part.

It works - kinda.  
But all I get is:

Not quite 3 lines as originally mentioned.

Sorry. This is way out of my skill set. Syntax with " ' ` and other such things has illuded (?) me for ever.

 ![Screenshot%20from%202018-09-20%2020-31-01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/39308793b7c1965b09a346a04aef672f0fbe12be.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [20 September 2018 10:35 UTC](https://discourse.nodered.org/t/node-warn-help/3300/8 "2018-09-20T10:35:05Z")

</div>

And what happens it you press the triangle in the warn sidebar?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [20 September 2018 10:37 UTC](https://discourse.nodered.org/t/node-warn-help/3300/9 "2018-09-20T10:37:20Z")

</div>

ARGH!

Sorry.

I thought I did it. Mia Culpa.

Now I am having fun with a function node with 4 outputs and working out if I always have to send 4 outputs, or if I can send any combination of.......

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 September 2018 16:23 UTC](https://discourse.nodered.org/t/node-warn-help/3300/10 "2018-09-20T16:23:06Z")

</div>

This should be the clue you need.  
[https://nodered.org/docs/writing-functions#multiple-outputs](https://nodered.org/docs/writing-functions#multiple-outputs)

---

<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:** [13 February 2019 20:50 UTC](https://discourse.nodered.org/t/node-warn-help/3300/11 "2019-02-13T20:50:07Z")

</div>

> [@Trying\_to\_learn](#):
>
> This is way out of my skill set. Syntax with " ' ` and other such things has illuded (?) me for ever.

'Eluded'.

The following will take you through the basics:

> **[JavaScript Strings](https://www.w3schools.com/js/js_strings.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

In JavaScript, single and double quotes are really the same, chose one and stick with it until you need to do something odd like trying to nest a set of quotes within a string.

back-ticks ([Template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)) are very different and only work in newer versions of nodejs and newer browsers. You can do all sorts of clever things with them such as multi-line strings and embedded JavaScript code. Avoid until you've mastered the basics. Still avoid unless you know that you are only working with newer environments. Still avoid until you hit a problem with normal quotes that you can't fix without lots of code. 🙂
