# Hello function 3 malfunction How it works

**URL:** <https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505>\
**Category:** Dashboard\
**Tags:** function-node\
**Created:** [1 November 2023 00:50 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505 "2023-11-01T00:50:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShinDongHen](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@ShinDongHen](https://discourse.nodered.org/u/ShinDongHen)\
**Post date:** [1 November 2023 00:50 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505/1 "2023-11-01T00:50:01Z")

</div>

Hello, thank you very much for your help. I really like the joy of learning.

in function block  
The part about the code doesn't seem to work well, but I also referenced information on the Internet.

var msg0={payload:(msg.payload[0]\<\<16+msg.payload[1])}  
return msg0;

We will send you the node below.

buffer 1 value and  
Buffer 2 values ​​are different. however  
The calculated value continues to be 524288... I would like to know if there is a problem with the code or if it needs to be returned again.

thank you.  
To everyone who replies and watches...  
[flows.json](https://discourse.nodered.org/uploads/short-url/yXDMrq6AzjAKP2hF4CtPhXYfjEN.json) (1.9 KB)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [1 November 2023 06:03 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505/2 "2023-11-01T06:03:03Z")

</div>

> [@ShinDongHen](#):
>
> buffer 1 value and  
> Buffer 2 values ​​are different. however  
> The calculated value continues to be 524288... I would like to know if there is a problem with the code

You cannot compare values in Buffer1 with values in Buffer2 because they are in two seperate messages.  
A function node can only work on a single message.  
You need to combine them into one message by setting msg.topic "buffer1" or "buffer2" and use a Join node in manual mode.

---

<div class="post-metadata">

**Author:** ![ShinDongHen](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@ShinDongHen](https://discourse.nodered.org/u/ShinDongHen)\
**Post date:** [1 November 2023 06:37 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505/3 "2023-11-01T06:37:51Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d40fdac7529adb2e269e7f15e4239caccb46212c.png)

I did it again separately and the result was the same.  
524288  
Did I do something wrong?

We will send you a sample node below.  
[flows (1).json](https://discourse.nodered.org/uploads/short-url/fw86hvFh6I09o9LKNCWkyaPV9Bz.json) (2.8 KB)

---

<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:** [1 November 2023 07:02 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505/4 "2023-11-01T07:02:31Z")

</div>

> [@ShinDongHen](#):
>
> Did I do something wrong

Yes - you need to make the buffers appear a single message.

See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

---

<div class="post-metadata">

**Author:** ![ShinDongHen](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@ShinDongHen](https://discourse.nodered.org/u/ShinDongHen)\
**Post date:** [1 November 2023 07:45 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505/5 "2023-11-01T07:45:58Z")

</div>

thank you

---

<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:** [1 December 2023 07:46 UTC](https://discourse.nodered.org/t/hello-function-3-malfunction-how-it-works/82505/6 "2023-12-01T07:46:12Z")

</div>

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