# Message queue node that can be indexed

**URL:** <https://discourse.nodered.org/t/message-queue-node-that-can-be-indexed/20555>\
**Category:** General\
**Created:** [19 January 2020 01:23 UTC](https://discourse.nodered.org/t/message-queue-node-that-can-be-indexed/20555 "2020-01-19T01:23:00Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 January 2020 11:20 UTC](https://discourse.nodered.org/t/message-queue-node-that-can-be-indexed/20555/29 "2020-01-20T11:20:58Z")

</div>

> [@Trying\_to\_learn](#):
>
> Ok, I'm stuck.
> 
> `node.warn("Next entry " + i+1);`
> 
> Doesn't work.
> 
> I get `11` if i = `1` .

The problem here is JavaScript uses the `+` symbol for both joining strings and adding numbers.

Because your statement has a string in it (the `"Next entry "` part), it will assume it should treat everything as a string, so the `1` ends up being `11` - just as `8` would end up as `81`.

The trick is to give the JavaScript interpreter a hint as to what order it should do the operations. I see you've used spaces in your statement, but you need to use brackets:

```auto
node.warn("Next entry " + (i+1) );

```

With those brackets, it will first do the `i+1`- where both sides are numbers, so it does numeric addition. It then does `"Next entry " + <result of (i+1)>` where there is a String, so it does a string join.

I hope that clarifies it.

---

_[View the full topic](https://discourse.nodered.org/t/message-queue-node-that-can-be-indexed/20555)._
